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.3 required=5.0 tests=BAYES_00,HEADER_SPAM autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fc772,b30bd69fa8f63cb2 X-Google-Attributes: gidfc772,public X-Google-Thread: 103376,b30bd69fa8f63cb2 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-17 08:41:39 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!uwm.edu!rpi!not-for-mail From: =?Windows-1252?Q?Terje_Sletteb=F8?= Newsgroups: comp.lang.ada,comp.lang.c++.moderated Subject: Re: C bug of the day Date: 17 Jun 2003 11:43:56 -0400 Organization: unknown Sender: cppmods@netlab.cs.rpi.edu Message-ID: <7gBHa.12174$KF1.273806@amstwist00> References: <1054751321.434656@master.nyc.kbcfp.com> NNTP-Posting-Host: netlab.cs.rpi.edu X-Original-Date: Tue, 17 Jun 2003 11:36:26 +0200 X-Submission-Address: c++-submit@netlab.cs.rpi.edu X-Auth: PGPMoose V1.1 PGP comp.lang.c++.moderated iQBVAwUAPu83OEHMCo9UcraBAQET0wH/YTeav5lIgN9PGpY5eQZzEnjLYQ4giGKL mnZ8CTCokJD2YEH5XSxbVmL/yhINvoguZaruA/9Tu+3MdjwmL60DJw== =DiCK Xref: archiver1.google.com comp.lang.ada:39344 comp.lang.c++.moderated:68537 Date: 2003-06-17T11:43:56-04:00 List-Id: wrote in message news:d6652001.0306160216.59fa74d6@posting.google.com... > > I know that in many cases, garbage collection isn't an option. This is > probably particularly true in the type of applications where Ada is most > used (although it isn't the case of the uses of Ada I'm familiar with). > Still, it is the safer option; IMHO, it should be on by default, but > with options to turn it off. One thing I haven't seen mentioned in this thread is that it appears that some think that if you have garbage collection, you won't have to do memory management. It's true that you can't completely leak memory, but you can still get the effect of memory leak, resulting from large structures still having a reference to them, but which are otherwise unused. This has also resulted in a host of new kinds of references for dealing with it, such as weak, soft and phantom references (in Java). Memory leak-like conditions also have expressions like lapsed listener, lingerers, laggards and limbo. Garbage collection just changes the problems you meet to something else, and not necessarily easier. Garbage collection might make it harder to manage resources, not easier. Besides, memory is just one kind of resource, and GC does nothing for other kinds. For languages without stack-allocated objects, like Java, you can't use RAII in its usual form, either (use of constructor/destructor). Instead, you have to resort to try-catch-finally, which can lead to spaghetti code, if you have several objects to clean up this way. Regards, Terje [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ]