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,c68551ab190372c8 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.glorb.com!news.zanker.org!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!mephistopheles.news.clara.net!news.clara.net!dyke.uk.clara.net From: Stephen Thomas Subject: Re: Ada memory management? Date: Thu, 07 Oct 2004 11:41:56 +0100 User-Agent: Pan/0.14.2.91 (As She Crawled Across the Table (Debian GNU/Linux)) Message-Id: Newsgroups: comp.lang.ada References: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@clara.net (please include full headers) X-Trace: a270636051188432d261016013809400d20410a3028298ca8a8141a841651e2c NNTP-Posting-Date: Thu, 07 Oct 2004 11:45:00 +0100 Xref: g2news1.google.com comp.lang.ada:4862 Date: 2004-10-07T11:41:56+01:00 List-Id: On Thu, 07 Oct 2004 12:00:42 +0200, Christoph Karl Walter Grein wrote: > procedure Does_This_Leak is > type Int_Ptr is access Integer; > ptr: Int_Ptr; > begin > ptr := new Integer; > end Does_This_Leak; > > Of course this leaks, and imagine how much! Actually, no it shouldn't, not on a halfway-decent implementation. Logically speaking, a storage pool for items accessed via values of an access type has the same lifetime as the access type itself. In the above example, a new storage pool for Int_Ptr is created on entry to Does_This_Leak, and is removed on exit. Stephen -- Your name is being called by sacred things That are not addressed nor listened to. Sometimes they blow trumpets.