Re: [xml] Questions about libxml as a DLL on win32.



Well, then I guess we can't agree on this.  Here's a makefile for
MSVC that shows the same results as the makefile for borland.

Makefile.msvc
-------------
#
# This is the unix build version of the makefile for SolitanLib
###############################################################

CC=cl.exe
OHEXT=obj

CFLAGS=/W3 /MT /O2 /GX /D "WIN32" /D "NDEBUG" \
        /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" \
        /FD
LFLAGS=

.cpp.obj:
        $(CC) $(CFLAGS) /c $<

DOTOH=dllfunctions.$(OHEXT) main.$(OHEXT)

all: $(DOTOH)
        $(CC) $(CFLAGS) /LD /Fedllfunctions.dll $(DOTOH) $(LFLAGS)
        $(CC) /Fetestdll.exe main.$(OHEXT) $(LFLAGS) dllfunctions.lib

clean:
        del *.$(OHEXT)
        del dllfunctions.dll
        del dllfunctions.lib
        del testdll.exe


All files are compiled with the same flags, and yet allocating memory
in the dll and freeing it in the main program causes memory leaks
and application crashes.

Steven

      

Did you compile and run my sample program ?  It demonstrates my point
pretty well.

No, I do not have time.  I can only tell you that your explanation is
incorrect.

Note, also that this problem can often be a silent one.  Your app might
not crash due to memory problems, but does it leak?  Have you watched
your memory traces to verify that everything is released properly, and
that
your memory useage actually goes down?

There are no memory leaks.  libxml2 has an extremely powerful mem debug
that, when enabled, can track every xmlMalloc() made.  You can can a summary
function that will show every call to xmlMalloc that wasn't xmlFree'ed.  

I can tell you that using libxml2 to process through 100,000 lines of
database i/o in the life of the program not a byte of memory is leaked.

_______________________________________________
xml mailing list
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml

-- 
==================================================================
== Steven M. Cherry                            smc cherrys org  ==
==                 http://family.cherrys.org/steven/index.html  ==
==================================================================




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