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,b30bd69fa8f63cb2 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-16 16:30:41 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsswitch.lcs.mit.edu!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Garbage Collector [Was: C bug of the day] Date: 16 Jun 2003 19:30:39 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <1054751321.434656@master.nyc.kbcfp.com> <2111742.ktbtd1Oagc@linux1.krischik.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1055806239 7736 199.172.62.241 (16 Jun 2003 23:30:39 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Mon, 16 Jun 2003 23:30:39 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: archiver1.google.com comp.lang.ada:39300 Date: 2003-06-16T19:30:39-04:00 List-Id: Martin Krischik writes: > Question is: did anybody ever do it? How difficult would it be to write a > true garbage collector as "plug in" storrage pool into an existing Ada? Ada's storage pools are very useful for writing custom allocation algorithms, for use with by-hand allocation and deallocation. However, I don't think they're much in help in writing a "true" garbage collector. By "true" GC, I presume you mean a tracing GC, with no explicit help from the mutator. A GC needs to know which fields of each record are pointers. The compiler knows that, but the storage pool type does not. Also, in order to tell which objects in a given storage pool are garbage, you have to know about all the pointers into that pool from outside -- from other pools, from the stack, and from statically allocated memory. The storage pool doesn't help there. Unless you're talking about so-called "conservative" garbage collection, in which case you can use existing ones (see Boehm). In general, a good garbage collector requires cooperation from the compiler. Even a so-called "conservative" GC requires that the compiler avoid certain "tricky" optimizations. - Bob P.S. If you're interested in GC, you should read the excellent Jones and Lins book on the subject.