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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b99897135d6631cc X-Google-Attributes: gid103376,public Path: g2news1.google.com!news1.google.com!news.glorb.com!meganewsservers.com!feeder2.on.meganewsservers.com!newshosting.com!nx01.iad01.newshosting.com!uunet!dca.uu.net!ash.uu.net!spool.news.uu.net!not-for-mail Date: Mon, 21 Jun 2004 13:51:04 -0400 From: Hyman Rosen User-Agent: Mozilla Thunderbird 0.7 (Windows/20040616) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: memory management and productivity References: <40d15023$1_1@baen1673807.greenlnk.net> <2jnh22F12nvieU2@uni-berlin.de> In-Reply-To: <2jnh22F12nvieU2@uni-berlin.de> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Organization: KBC Financial Products Message-ID: <1087840264.973597@master.nyc.kbcfp.com> Cache-Post-Path: master.nyc.kbcfp.com!unknown@nightcrawler.nyc.kbcfp.com X-Cache: nntpcache 3.0.1 (see http://www.nntpcache.org/) NNTP-Posting-Host: 204.253.250.10 X-Trace: 1087840265 1398 204.253.250.10 Xref: g2news1.google.com comp.lang.ada:1748 Date: 2004-06-21T13:51:04-04:00 List-Id: Jano wrote: > correct me in that case. OK. > IIRC, in C++ you must destroy (delete?) the object to get the destructor > called. So, even if you have a carefully built chain of destructors, if > at some point you forget to destroy the root, you're leaking. > > In Ada, when an object goes out of scope (assuming it has been created > in the stack and not with the "new" operator), it's automatically > finished so you have one less thing to care about. Both in C++ and in Ada, a stack object is finalized/destructed automatically when its scope is exited. I believe, but I'm not sure, that in Ada if a pointer *type* (not a pointer object) goes out of scope, then all objects of that type are deallocated.