You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Iggeres <py...@2vias.com.ar> on 2003/03/22 23:37:33 UTC

Question

Hi,
I'm using xerces and I have a problem:
I'm creating a buffer using:

 XMLCh *search = XMLString::transcode(":");

and then destroy the buffer with

free((void *) search);

I know that it's not the best way and it is not exception safe, but it was working until I compiled in release my applicacion. Then, it thru a exception.
I tried to change it using 

 delete [] search;

and I have the same problem.
I know that I can use DOMString and it has to work, but I want to know what is going on with this code.

Tanks,

Iggeres.

Re: Question

Posted by Iggeres <py...@2vias.com.ar>.
I'm using xercesc 2.1 and XMLString::release doesn't exist.
What api function I must use?
I saw some sample programs in the distribution and they use delete.

----- Original Message ----- 
From: "Vitaly Prapirny" <ma...@mebius.net>
To: <xe...@xml.apache.org>
Sent: Sunday, March 23, 2003 8:02 AM
Subject: Re: Question


> Which are your xercesc version, OS, compiler ?
> 
> Memory manager used by xercesc library can be different from
> memory manager your code using. And buffer allocated in one
> memory manager can not be freed by another.
> 
> In xercesc 2.2 you may call XMLString::release(...) for
> safely deleting the buffer returned by XMLString::transcode.
> 
> > Iggeres wrote:
> > 
> > Hi,
> > I'm using xerces and I have a problem:
> > I'm creating a buffer using:
> > 
> >  XMLCh *search = XMLString::transcode(":");
> > 
> > and then destroy the buffer with
> > 
> > free((void *) search);
> > 
> > I know that it's not the best way and it is not exception safe, but it
> > was working until I compiled in release my applicacion. Then, it thru
> > a exception.
> > I tried to change it using
> > 
> >  delete [] search;
> > and I have the same problem.
> > I know that I can use DOMString and it has to work, but I want to know
> > what is going on with this code.
> > 
> > Tanks,
> > 
> > Iggeres.
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: Question

Posted by Vitaly Prapirny <ma...@mebius.net>.
Which are your xercesc version, OS, compiler ?

Memory manager used by xercesc library can be different from
memory manager your code using. And buffer allocated in one
memory manager can not be freed by another.

In xercesc 2.2 you may call XMLString::release(...) for
safely deleting the buffer returned by XMLString::transcode.

> Iggeres wrote:
> 
> Hi,
> I'm using xerces and I have a problem:
> I'm creating a buffer using:
> 
>  XMLCh *search = XMLString::transcode(":");
> 
> and then destroy the buffer with
> 
> free((void *) search);
> 
> I know that it's not the best way and it is not exception safe, but it
> was working until I compiled in release my applicacion. Then, it thru
> a exception.
> I tried to change it using
> 
>  delete [] search;
> and I have the same problem.
> I know that I can use DOMString and it has to work, but I want to know
> what is going on with this code.
> 
> Tanks,
> 
> Iggeres.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org