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-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!fu-berlin.de!uni-berlin.de!not-for-mail From: Jano Newsgroups: comp.lang.ada Subject: Re: memory management and productivity Date: Mon, 21 Jun 2004 09:29:06 +0200 Message-ID: <2jnh22F12nvieU2@uni-berlin.de> References: <40d15023$1_1@baen1673807.greenlnk.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: news.uni-berlin.de d4jzNBPdgEu2wTfz/svUFQYND+uNkiKz764Gj2HKEtiMljihY= User-Agent: Mozilla Thunderbird 0.7 (Windows/20040616) X-Accept-Language: en-us, en In-Reply-To: Xref: g2news1.google.com comp.lang.ada:1724 Date: 2004-06-21T09:29:06+02:00 List-Id: Russ wrote: > "Martin Dowie" wrote in message news:... > >>"Russ" <18k11tm001@sneakemail.com> wrote in message >>news:bebbba07.0406181510.37b8f5e2@posting.google.com... >> >>>>You will be delighted to here that Ada already supports GC thought the >>>>use of Controlled types then. And if that weren't enough you can grap >>>>"Boehm-Demers-Weiser" GC from AdaCL @ http://adacl.sourceforge.net/. >>> >>>I am indeed delighted to hear that. And if Ada really has automatic >>>memory management capabilities, more people need to know it. >> >>Hopefully this thread will breath the life of publicity to this package then >>:-) >> >> >> >>>However, I am curious about why initialize and finalize are different >>>and better than constructors and destructors in C++. >> >>I never made such a claim. > > > Well, if initialize and finalize are fundamentally no different than > constructors and destructors, then I conclude that Ada does not have > automated memory management any more than C++ has it. (I may be a bit > slow, but I catch on eventually.) It's been so many time since I did C++ that I may be wrong, correct me in that case. 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.