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!news1.google.com!news.glorb.com!zen.net.uk!dedekind.zen.co.uk!news.zanker.org!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: Wed, 13 Oct 2004 09:58:00 +0200 Organization: AdaCL Message-ID: <1229542.yCC3o0mUtn@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 1097654856 01 2299 3a5oXxeOT09+vQh 041013 08:07:36 X-Complaints-To: usenet-abuse@t-online.de X-ID: V35Y3mZTweQ4XfoBGZj0bmnia9ty4M-mdFcWNTZZCejk-hfOZOVQ6V User-Agent: KNode/0.8.0 Xref: g2news1.google.com comp.lang.ada:5134 Date: 2004-10-13T09:58:00+02:00 List-Id: Matthew Heaney wrote: > Stephen Leake writes: > >> function Create (Data : in Ada.Streams.Stream_Element_Array) >> return Udp_Message >> is >> Msg : Udp_Message := >> (Ada.Finalization.Controlled with >> Data => new Ada.Streams.Stream_Element_Array'(Data)); >> begin >> return Msg; >> end Create; > > Implement Create this way: > > function Create (Data : in Ada.Streams.Stream_Element_Array) > return Udp_Message is > begin > return (Controlled with new Stream_Element_Array'(Data)); > end Create; > > Rerun your program with the change above and post your results. Well I don't really see a difference - apart from being move verbose and easier to debug. Once the optimiser discovers that Msg is only used once the same code should be the same. With Regards Martin -- mailto://krischik@users.sourceforge.net http://www.ada.krischik.com