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!news.maxwell.syr.edu!peernews-us.colt.net!colt.net!peernews3.colt.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 15:02:19 +0200 Organization: AdaCL Message-ID: <1141547.LoYYWXntGt@linux1.krischik.com> References: 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 1097503088 03 26417 fYUoXzhrGKAqiyX 041011 13:58:08 X-Complaints-To: usenet-abuse@t-online.de X-ID: TlDCmmZbgeKDtSol1t+QTywYxDuFncunNVpCOCsXCJb+JZ3g2ozkZo User-Agent: KNode/0.8.0 Xref: g2news1.google.com comp.lang.ada:5045 Date: 2004-10-11T15:02:19+02:00 List-Id: Marius Amado Alves wrote: > Alex R. Mosteo wrote: >> Marius Amado Alves wrote in message >> news:... >> >>>> if This.Data /= null then >>>> This.Data := new Stream_Element_Array'(This.Data.all); >>>> end if; >>> >>>To my pointerless eyes this looks very leaky. >> >> Could you elaborate? I'm trying to do a deep copy. > > The "new" expression yields a new pointer value, the assignment smashes > the old one with this new value, so the old pointer is lost, and unless > some magic was put it place the old pointee becomes a zombie. Well there is allways the shallow part of the deep copy. The original pointer is still part of the original record. When the original record is destroyed a deep delete (in Finalise) should deal with the original pointer. With Regards Martin -- mailto://krischik@users.sourceforge.net http://www.ada.krischik.com