comp.lang.ada
 help / color / mirror / Atom feed
From: "Thomas Løcke" <tl@ada-dk.org>
Subject: Re: My XML/Ada code is leaking [SOLVED]
Date: Wed, 18 May 2011 14:11:25 +0200
Date: 2011-05-18T14:11:25+02:00	[thread overview]
Message-ID: <4dd3b755$0$304$14726298@news.sunsite.dk> (raw)
In-Reply-To: <4dd2e2c0$0$315$14726298@news.sunsite.dk>

On 05/17/2011 11:04 PM, Thomas L�cke wrote:
> Hey all,
>
> I'm using XML/Ada to build some Atom XML, and while things in general
> are going well, I've hit a wall in a part of the code where I need to
> build a DOM document from some string XML and add it to a DOM node.
>
> The problem is basically that my code leaks, and I can't figure out how
> to fix it.
>
> I've made this small example that show the exact problem:
>
> http://pastebin.com/a8t0tAC2
>
> When I execute the program using this:
>
> valgrind -v --leak-check=full --track-origins=yes foobar
>
> I get a leak looking like this:
>
> ==18942== LEAK SUMMARY:
> ==18942== definitely lost: 144 bytes in 1 blocks


I've solved the problem by getting rid of the First_Child call at line
124. That resulted in an excessive amount of XML declarations being
written, but that was easily solved by adding

     Print_XML_Declaration => False

to my DOM.Core.Nodes.Write call. Oh and I didn't add the entire output
code to the pastebin example, so you wont be able to find the Write call
in there. Just trust me when I say that it works.  :o)

I still don't quite understand why First_Child would cause those issues
but at least I now have a functioning system, and it's probably also a
faster system, as I'm no longer wasting time returning the First_Child
to get rid of the XML declarations. Yay!

-- 
Thomas L�cke

Email: tl at ada-dk.org
Web: http//:ada-dk.org
http://identi.ca/thomaslocke



  reply	other threads:[~2011-05-18 12:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-17 21:04 My XML/Ada code is leaking Thomas Løcke
2011-05-18 12:11 ` Thomas Løcke [this message]
2011-05-18 13:04 ` Simon Wright
2011-05-18 13:15   ` Thomas Løcke
2011-05-18 14:20     ` Georg Bauhaus
2011-05-18 19:01       ` Simon Wright
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox