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,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3498dd887729ed19 X-Google-Attributes: gid103376,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: Garbage Collection in Ada Date: 1996/10/15 Message-ID: #1/1 X-Deja-AN: 189661488 references: <01bbb910$f1e73f60$829d6482@joy.ericsson.se> <199610132138291604607@dialup101-6-14.swipnet.se> <19961015122319668722@dialup98-6-12.swipnet.se> organization: The World Public Access UNIX, Brookline, MA newsgroups: comp.lang.ada Date: 1996-10-15T00:00:00+00:00 List-Id: In article <19961015122319668722@dialup98-6-12.swipnet.se>, Lars Farm wrote: >With GC the problem of "clean up" of memory is defined away. There is no >way to be "sloppy" about deallocating memory with GC. There is no >problem, pure and simple. That this is hard to accept is IMHO a clear >indication that this really is a hard problem (without GC). It's hard to accept because it's not true. ;-) I've seen storage leaks in Lisp and Smalltalk programs. All you have to do is forget to nil-out a pointer to something that will never be used again, and then the GC will not notice that this thing is really garbage. True example from a Smalltalk program: User can do something that pops up a window on the screen, and later close it, getting rid of it. However, there was a bug: there was a linked list of all windows, and the system was failing to unlink windows from that list when they were no longer needed. After a day or two of using the system, it would run out of memory. That's a memory leak, and the GC didn't prevent it. So, GC doesn't eliminate storage leaks -- it just eliminates *most* storage leaks. That's a good thing, but I think it's important to remember that it's not perfect. Conservative GC's are even worse -- it is possible to not free an object even when there are no pointers to it, because the GC doesn't know the difference between an integer and a pointer. Note that the following is also possible: Suppose I have a program with explicit Free operations, with no storage leaks. Suppose I erase all the calls to Free, and insert a non-conservative GC. It is quite possible that the program will now leak storage. >Sure, if a solution solves a majority of problems and leaves some to >traditional techniques, is that not better than a solution that solves >none? Agreed. - Bob