The problem is not restricted to statically linking libraries together. Anytime your application (or library) uses custom heaps, you may run into problems. For instance, in our applications, we use a custom heap manager which creates muliple heaps and is tuned for multi CPU performance.
We then override the new and delete operators to use our custom heap. Thus we can never call delete on the memory allocated by the transcode method as it is going to a completely different heap manager. In this case we are using the pre-built binary DLL that the Xerces team makes available. If we were to rebuild the library with our own memory manager, the problem would not exist, however I am just talking about "out of the box" functionality.
I should also note that this problem is not specific to BCB, it can apply to any situation where an application is using a memory manager different from the memory manager used to compile the library.
Having said this, all of my problems were solved by using the XMLString::transcode routines which accept a buffer to write into.
Samar
-----Original Message-----
From: Don Mastrovito [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 13, 2001 10:23 AM
To: [EMAIL PROTECTED]
Subject: RE: Freeing memory allocated by transcode() in Borland C++
Builder
Yes, you can build Xerces and your application such that there will be
multiple memory managers. If you use the BCB5 project file to build
Xerces, you will see that it goes out of it's way not to do that and
thereby avoid the problems. Run Dependency Walker
(http://www.dependencywalker.com/) on the resulting DLL and you will see
the external references to the memory manager and run time libraries. If
you choose to change the way Xerces is linked, then Xerces needs to supply
a function to release memory. Until the Xerces team implements such a
function, statically linking a memory manager into Xerces will produce
suicidal results.
Don
At 11:07 AM 11/13/2001 -0500, you wrote:
>but multiple memory managers do exist, identical ones that use different
>heaps.
>
>Herb...
>
>
>
>
>My understanding is that calls to Transcode will perform the allocation,
>but it is the caller's responsibility to free the memory when it is no
>longer being used. That said, there have been suggestions that Xerces
>provides a "freemem" function to allow the caller to free the memory. I
>don't believe that such a function has been implemented. Technically it
>shouldn't be needed unless you are trying to address the problem of
>allowing multiple memory managers to exist.
>
>
>
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
