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,a77baf86c187076a X-Google-Attributes: gid103376,public From: Hans-Juergen Boehm Subject: Re: Garbage collection (was a spinoff of a spinoff of a GA diatribe) Date: 1996/10/24 Message-ID: <32704FD9.41C6@mti.sgi.com>#1/1 X-Deja-AN: 191904032 references: <9610211427.AA06636@most> content-type: text/plain; charset=us-ascii organization: Silicon Graphics Inc., Mountain View, CA mime-version: 1.0 newsgroups: comp.lang.ada x-mailer: Mozilla 2.0S (X11; I; IRIX 6.2 IP22) Date: 1996-10-24T00:00:00+00:00 List-Id: Robert I. Eachus wrote: > > In article jsa@alexandria (Jon S Anthony) writes: > > > Pro: ... > > Faster - allocations can be _much_ faster and collections can be > > much more efficient than good ol' "free". > > > Works across the board (no need for special casing various situations) > > You must have been smoking some good stuff. Precise collectors can > do the later, but never the former. Think for a second, any reclamation > the garbage collector can do, the free routine can do as well, without > the memory scan for live references. > This is wrong for many reasons: 1. Deallocating many objects at once is much faster than deallocating them one at a time in sequence. Free list headers are already in registers, etc. 2. In a multithreaded environment with a single heap, the collector has to perform one lack acquisition/release per roundtrip. Explicit deallocation needs 2. 3. "Precise" collectors can arrange to allocate from contiguous memory which may be much cheaper. 4. It ignores all bookkeeping costs (e.g. reference counts) required for manual deallocation. These can easily dominate. 5. Certain algorithms require SUBSTANTIALLY more locking without GC. In fact even our conservative collector often beats C malloc/free for very small objects. Please feel free to try the experiment, especially before posting remarks like the above. May I also suggest a scan of the recent literature? If you're interested in conservative collection, you might start with http://reality.sgi.com/employees/boehm_mti/gc.html It discusses some of these issues and points to some more general standard references. -- Standard disclaimer ... Hans-Juergen Boehm boehm@mti.sgi.com