You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xerces.apache.org by John Ky <ne...@yahoo.com> on 2000/05/18 17:12:38 UTC

Transcode in Xerces-C

In the Sample files (DOMPrint), the string returned
by DOMString.transcode is deleted after it is used.

Is this proper?  When I try to do that in my own
project, Microsoft VC++ 6 throws some kind of
user breakpoint or exception when the delete is
attempted.

No problems when running the same code on Solaris.

I am concerned that on the one hand, I could be
causing memory leaks, and on the other hand, that
my project won't run.

Which is the proper way?  Are my VC++ 6 project
settings totally out of whack?

Thanks

John


__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com

Re: Transcode in Xerces-C

Posted by Michael Mason <mg...@decisionsoft.com>.
John Ky wrote:
> 
> In the Sample files (DOMPrint), the string returned
> by DOMString.transcode is deleted after it is used.
> 
> Is this proper?  When I try to do that in my own
> project, Microsoft VC++ 6 throws some kind of
> user breakpoint or exception when the delete is
> attempted.
> 
> No problems when running the same code on Solaris.
> 
> I am concerned that on the one hand, I could be
> causing memory leaks, and on the other hand, that
> my project won't run.
> 
> Which is the proper way?  Are my VC++ 6 project
> settings totally out of whack?

You should delete the memory, yes. Your problem is mixing debug and
non-debug versions of the runtime libraries. If you're using the
pre-built version of Xerces, it used the non-debug libraries. If you use
the debug libs for your code, the delete in your code will attempt to
delete off a different stack (wierdness through mixing the libs).

Solution: Build yourself a debug version of the Xerces libs and use
that, or build your kit without debug. More on this is available on the
xerces-c-dev mailing list (this one is deprecated). You could also check
the archives.

Mike.

-- 
Mike Mason, Software Engineer
XML Script Development Team                    Office: 44-1865-203192
http://www.xmlscript.org/                      Mobile: 44-7050-288923