home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!decwrl!parc!boehm
- From: boehm@parc.xerox.com (Hans Boehm)
- Subject: Re: Garbage Collection for C++
- Message-ID: <boehm.714410546@siria>
- Sender: news@parc.xerox.com
- Organization: Xerox PARC
- References: <TMB.92Aug16164940@arolla.idiap.ch> <1992Aug18.021453.24394@news.mentorg.com> <DAVEG.92Aug17224359@synaptx.synaptics.com> <1992Aug20.213720.16599@microsoft.com>
- Date: 21 Aug 92 15:22:26 GMT
- Lines: 35
-
- jimad@microsoft.com (Jim Adcock) writes:
- >In generation schemes, both long-lived and short-lived objects have
- >allocation and deallocations costs that are very very small -- IE "0"
- >There are significant allocation and deallocation costs only for object
- >that fall in between these two extremes -- objects that live to be middle
- >aged. And the cost of these objects is not really the cost of allocating
- >or deallocating them, but rather the cost of keeping them young.
-
- Could you clarify your accounting for long-lived objects here? Are you
- assuming that you know at allocation time that the object will be
- permanent? Otherwise it must be copied at least once out of the youngest
- generation. That's certainly nonzero cost. Furthermore, it will probably
- be copied (or traced) several more times as the result of full collections.
- (If I don't know that all my objects are essentially permanent, and I
- see my heap growing, I presumably have to initiate full collections
- occasionally.) In addition to this, I need some way of tracking
- pointer stores into the old object. I would claim that all of this adds
- up to significantly more than malloc/free time for the object.
-
- Generational (esp. copying) collectors win dramatically on short-lived
- objects, provided you have some efficient way of tracking stores
- into old objects. Fortunately most objects fall into this category
- for most programs.
-
- (Ben Zorn has some measurements that substantiate this for some
- interesting C programs. It is clearly the case for all known
- Lisp and Smalltalk implementations.)
-
- A generational copying collector is probably the worst possible choice if
- all your program allocates are large long-lived bitmaps (and indeed
- generational copying collectors usually treat such things as a special
- case).
-
- Hans-J. Boehm
- (boehm@parc.xerox.com)
-