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 Samar Abbas Lotia <sl...@nQuire.com> on 2001/11/13 16:40:44 UTC

RE: Freeing memory allocated by transcode() in Borland C++ Builde r

I am still fairly new to Xerces so perhaps I'm missing something here, but
it seems that there are some transcode methods available in the XMLString
class which take a buffer to write into. This way, the caller can be
responsible for allocating the buffer and cleaning it up, rather than have
the Xerces library allocate the buffer and have the caller be responsible
for cleaning it up.

On a related question, does Xerces provide an interface to clean up memory
allocated using the transcode() method? If the API is to be maintained as
is, i.e. having the library allocate memory which is to be freed up by the
caller, and if there is no such 'deallocate' method, perhaps one should be
added as a static member of the class in question.

Samar Lotia

-----Original Message-----
From: Don Mastrovito [mailto:dmastrovito@marathontechnologies.com]
Sent: Tuesday, November 13, 2001 8:08 AM
To: xerces-c-dev@xml.apache.org
Subject: Re: Freeing memory allocated by transcode() in Borland C++
Builder


Ralf,

If you use the BCB5 project files to build your copy of Xerces, the DLL 
produced will utilize the multi-threaded run time library CC3250MT.DLL and 
memory manager BORLNDMM.DLL supplied with your copy of C++Builder5.  I 
chose not to statically link these libraries with Xerces so applications 
and Xerces will use the same copy of the memory manager.  The -tWM switch 
tells the compiler that the target image is for Windows and is 
multi-threaded.  I believe this is the default setting for most 
projects.  Naturally, your application must use the same multi-threaded 
runtime and memory manager as the Xerces library.  If you are statically 
linking these into your application, that's the source of your problem.

I've read the most of the chatter about releasing memory returned by 
Transcode.  The problems seem to affect all build environments (VC++, Sun, 
etc.).  I have no reason to think what you are seeing is specific to the 
BCB build of Xerces.

BTW, I don't keep the BCB4 project up to date.  So if you are building with 
it, I'll lend words of wisdom, but you are largely on your own.  Sorry, but 
I no longer have BCB4 installed.

Don

At 06:02 PM 11/11/2001 +0100, you wrote:
>Hi,
>
>I just have a small problem with freeing the memory which was reserved
>by transcode(). The problem seems to be that my program just can't
>free the memory allocated by Xerces. I read about this problem very
>often here on the list and there was said, the solution is to use a
>multithreaded DLL version of the runtime library - but I couldn't find
>any option or something like this in C++ Builder. I found a flag
>called -tWM, but it doesn't help anything, the problem occurs even
>after a full build.
>Did anybody encountered the same problem with C++ Builder ?
>
>Regards,
>Ralf Ebert
>
>
>---------------------------------------------------------------------
>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