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=-2.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI autolearn=unavailable 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!freenix!enst.fr!melchior!cuivre.fr.eu.org!melchior.frmug.org!not-for-mail From: "Christoph Karl Walter Grein" Newsgroups: comp.lang.ada Subject: Re: Memory leak - What the ...? Date: Mon, 11 Oct 2004 11:50:12 +0200 Organization: http://freemail.web.de/ Message-ID: NNTP-Posting-Host: lovelace.ada-france.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: melchior.cuivre.fr.eu.org 1097488231 14248 212.85.156.195 (11 Oct 2004 09:50:31 GMT) X-Complaints-To: usenet@melchior.cuivre.fr.eu.org NNTP-Posting-Date: Mon, 11 Oct 2004 09:50:31 +0000 (UTC) To: comp.lang.ada@ada-france.org Return-Path: Precedence: fm-user X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at ada-france.org X-BeenThere: comp.lang.ada@ada-france.org X-Mailman-Version: 2.1.4 List-Id: "Gateway to the comp.lang.ada Usenet newsgroup" List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: g2news1.google.com comp.lang.ada:5036 Date: 2004-10-11T11:50:12+02:00 procedure Test is Empty : Udp_Message; Arr : array (1 .. 1000) of Udp_Message; -- Initialize is called for Empty and each component of Arr; -- does nothing since not overridden. begin Text_Io.Put_Line ("Adding..."); for I in Arr'Range loop Arr (I) := Create ((1 .. Stream_Element_Offset (I) => Stream_Element'First)); -- Create an intermediate object Msg in place with Data as given. -- Neither Initialize nor Adjust is called. -- Finalize (Arr (I)); ==> Left side of assignment statement; -- does nothing since Data = null. -- Copy Msg to Arr (I) ==> Shallow copy. -- Adjust (Arr (I)); ==> Make a deep copy from This.Data.all -- (this is Msg.Data). -- Finalize Msg ==> Destruct the intermediate object, i.e. -- de-allocate Msg.Data. -- I cannot see a problem here. end loop; Text_Io.Put_Line ("Deleting..."); for I in Arr'Range loop Arr (I) := Empty; -- Finalize (Arr (I)); ==> Left side of assignment statement; -- de-allocates Data. -- Copy Empty to Arr (I) -- Adjust (Arr (I)); ==> does nothing since Empty.Data = null. end loop; -- Finalize is called for each component of Arr in inverse sequence, then -- for Empty. -- Does nothing since Data = null always. -- -- I can't see a problem. exception when E: others => Text_Io.Put_Line ("Exception: " & Exceptions.Exception_Information (E)); end Test; ________________________________________________________________ Verschicken Sie romantische, coole und witzige Bilder per SMS! Jetzt neu bei WEB.DE FreeMail: http://freemail.web.de/?mc=021193