Re: [xml] Memory tag errors on xmlCleanupCharEncodingHandlers
- From: Marco Rogers <marco rogers gmail com>
- To: veillard redhat com
- Cc: xml gnome org
- Subject: Re: [xml] Memory tag errors on xmlCleanupCharEncodingHandlers
- Date: Thu, 26 Aug 2010 02:12:56 -0400
Hmmm. ÂI definitely see what you're talking about. ÂI guess I'm misinterpretting what the debugger is telling me. ÂI'm setting a breakpoint on xmlMallocBreakpoint and getting this traceback.
Memory tag error occurs :0x100c26838Â
xmlMemFree(100C26860) error
Breakpoint 1, 0x00000001258e7640 in xmlMallocBreakpoint ()
#0 Â0x00000001258e7640 in xmlMallocBreakpoint ()
#1 Â0x00000001258b553d in xmlCleanupCharEncodingHandlers ()
#2 Â0x00000001258beb55 in xmlCleanupParser ()
#3 Â0x00007fff82d7f7f4 in __cxa_finalize ()
#4 Â0x00007fff82d7f70c in exit ()
#5 Â0x000000010000ee0f in start () at checks.h:63
I'm not great with gdb yet. ÂWhat further commands can I run to trackdown exactly where the problem is occuring? ÂAm I setting up memory debugging correctly? ÂWhat other methods can I use to pinpoint the problem?
Thanks
:Marco
On Wed, Aug 25, 2010 at 4:22 PM, Daniel Veillard
<veillard redhat com> wrote:
On Sun, Aug 22, 2010 at 05:20:03PM -0400, Marco Rogers wrote:
> I believe I've found a bug, or at least annoying issue in libxml2.
>
> So I've got a library that is using libxml2 heavily. I had to turn on memory
> tracking in the so I can inspect the total memory allocated by libxml2.
>
> xmlMemSetup(xmlMemFree, xmlMemMalloc, xmlMemRealloc, xmlMemoryStrdup);
>
> Â xmlInitMemory();
>
> //
http://github.com/polotek/libxmljs/blob/master/src/libxmljs.cc#L160-161
>
> But now I get the Memory tag errors that occur when xml memory isn't
> allocated or freed properly. ÂI've studied this issue a lot because I
> thought it might be a problem of mine. ÂHere's an example thread below (not
> mine, just helped me understand the problem).
>
>
http://mail.gnome.org/archives/xml/2010-April/msg00035.html
>
> I understand things now and I've been debugging to track down where this
> happens. ÂDespite what I might be doing in my library, I always get several
> memory errors. ÂI've traced the problem to the
> function xmlCleanupCharEncodingHandlers that gets called in
> xmlCleanupParser.
>
> The function calls xmlFree on all of the names of the handlers. ÂBut the
> names were not created with xmlMalloc. ÂThey are passed in as literal
> strings. ÂSee ecoding.c around line 1351.
ÂSounds wrong to me on 2 counts:
 Â1/ the handler name is up = xmlMemStrdup() line 1286, not the raw
   strring passed to the function call
 Â2/ libxml2 when compiled with memory debug use a memory wrapper
   which does an xmlMemSetup() equivalent and all functions go
   though that wrapped allocator. If the problem was present even
   the most trivial tests would fail in this mode.
The problem is likely to be somewhere else...
--
Marco Rogers
marco rogers gmail comLife is ten percent what happens to you and ninety percent how you respond to it.
- Lou Holtz
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]