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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ec2a500cce3658c4 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsmm00.sul.t-online.de!t-online.de!news.t-online.com!not-for-mail From: Martin Krischik Newsgroups: comp.lang.ada Subject: Re: Memory leak - What the ...? Date: Mon, 11 Oct 2004 14:59:25 +0200 Organization: AdaCL Message-ID: <1257012.4zRLN5mzyz@linux1.krischik.com> References: <1115377.iDqY0doAkG@linux1.krischik.com> <416a4936$1_1@baen1673807.greenlnk.net> Reply-To: krischik@users.sourceforge.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news.t-online.com 1097503087 03 26417 fYUoXzhrVKWVSMED 041011 13:58:07 X-Complaints-To: usenet-abuse@t-online.de X-ID: GhmMerZ6Ze2-6UZst+PEROlldSIoBGo9kXZyamy0DvN-O7wah2GmUi User-Agent: KNode/0.8.0 Xref: g2news1.google.com comp.lang.ada:5044 Date: 2004-10-11T14:59:25+02:00 List-Id: Martin Dowie wrote: > Martin Krischik wrote: >> Marius Amado Alves wrote: >> >>>> if This.Data /= null then >>>> This.Data := new Stream_Element_Array'(This.Data.all); >>>> end if; >>> >>> To my pointerless eyes this looks very leaky. >> >> Why? It look OK to me. Of course one would expect This.Data to be >> initialised in Initialize so that This.Data is allways /= null... > > This code says: > "If this pointer contains anything (not null) then make it point to > something new /without/ dealing with the original". > But it is still early... ;-) Which should be Ok for Adjust. After all the Adjust standart tasks deep copy - and not deep move. You can use Adjust for a deep move but that would be special purpose. A Finalise following the adjust should deal with the original. With Regards Martin -- mailto://krischik@users.sourceforge.net http://www.ada.krischik.com