From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,48c24b3b7b6825bf X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news2.google.com!news2.google.com!news.glorb.com!news.tele.dk!feed118.news.tele.dk!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail Date: Wed, 18 May 2011 14:11:25 +0200 From: =?ISO-8859-1?Q?Thomas_L=F8cke?= User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110501 Thunderbird/3.1.10 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: My XML/Ada code is leaking [SOLVED] References: <4dd2e2c0$0$315$14726298@news.sunsite.dk> In-Reply-To: <4dd2e2c0$0$315$14726298@news.sunsite.dk> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Message-ID: <4dd3b755$0$304$14726298@news.sunsite.dk> Organization: SunSITE.dk - Supporting Open source NNTP-Posting-Host: 83.91.213.86 X-Trace: news.sunsite.dk DXC=KNA:n?W^LaM3j@n`X75YjCYSB=nbEKnkK^gR2fXIEW1M3ZOKe3?:>XADZkco8YM<=KU`JRC]IM5=Eg:2T:PYFdeB X-Complaints-To: staff@sunsite.dk Xref: g2news2.google.com comp.lang.ada:20264 Date: 2011-05-18T14:11:25+02:00 List-Id: 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