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!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed-east.nntpserver.com!nntpserver.com!newsfeed1.sea.pnap.net!newsfeed.pnap.net!brmea-news-1.sun.com!news1brm.central.sun.com!new-usenet.uk.sun.com!not-for-mail From: Ole-Hjalmar Kristensen Newsgroups: comp.lang.ada Subject: Re: memory management and productivity Date: 21 Jun 2004 10:14:34 +0200 Organization: Sun Microsystems Message-ID: References: <40d15023$1_1@baen1673807.greenlnk.net> <2jnh22F12nvieU2@uni-berlin.de> NNTP-Posting-Host: europa1.norway.sun.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: new-usenet.uk.sun.com 1087805675 10792 129.159.113.161 (21 Jun 2004 08:14:35 GMT) X-Complaints-To: usenet@new-usenet.uk.sun.com NNTP-Posting-Date: 21 Jun 2004 08:14:35 GMT User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7 Xref: g2news1.google.com comp.lang.ada:1730 Date: 2004-06-21T08:14:35+00:00 List-Id: Jano writes: > 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. Yes, *IF* it has been allocated with new. > > 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. This is exactly the same as C++. I would say that Ada and C++ are more or less on equal footing when it comes to garbage collection in practice. -- C++: The power, elegance and simplicity of a hand grenade.