Re: [xml] Problems with xmlFree and linking in Mingw gcc 3.2



On Wed, Sep 17, 2003 at 12:25:18AM -0700, Anand Panangadan wrote:
I came upon this posting while searching for a
solution to a similar problem. Using xmlFree() causes
an immediate crash. If I replace xmlFree() with
free(), the program runs fine on Win98, but crashes
after parsing some input on WinXP. 
This happens with both libxml2-2.5.8 and 2.5.10 DLLs.
I have seen postings of this problem on other forums
too, but without any solution. 
Help, please?

  One problem could be that the memory allocation function
obtained at compile time when referencing the address for 
free() malloc() and realloc() are functions not compatible
with the free() malloc() and realloc() function used at runtime,
this sounds screwed, but perfectly possible in an MS world
with a mix of compilers, options, DLL and others "our platform
has a shorter Time To Market" jokes...
  One possible solution could be to call xmlMemSetup(), see
    http://xmlsoft.org/xmlmem.html
from the start of the program to force the library to use the
version of free() malloc() and realloc() in use by the 
main() part of the program instead of the ones found at 
link time. Of course this call to xmlMemSetup() should be done
before xmlInitParser() since this routine does memory allocations.

Daniel

-- 
Daniel Veillard      | Red Hat Network https://rhn.redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]