home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!europa.asd.contel.com!darwin.sura.net!Sirius.dfn.de!math.fu-berlin.de!news.netmbx.de!Germany.EU.net!mcsun!sunic!seunet!appli!niklas
- From: niklas@appli.se (Niklas Hallqvist)
- Newsgroups: comp.lang.c++
- Subject: Re: Garbage Collection for C++
- Message-ID: <2009@appli.se>
- Date: 16 Aug 92 01:10:05 GMT
- References: <1992Aug6.014619.2111@ucc.su.OZ.AU> <DAVEG.92Aug13025629@synaptx.synaptics.com> <1992Aug14.021547.15215@news.mentorg.com> <DAVEG.92Aug14194411@synaptx.synaptics.com>
- Organization: Applitron Datasystem AB, GOTHENBURG, SWEDEN
- Lines: 19
-
- I just wanted to say that conservative GC won't really help in all
- situations. Jonathan Shapiro taught me this useful trick once.
- When you want to do a doubly linked list to the cost of a singly
- linked one (i.e. in mem. space). Instead of having two pointers
- for the link in each node, take the "previous" and "next" pointers
- and XOR them, and store the result! Now you just need to store two
- entry consecutive points into the list, and make an iterator intelligent
- enough to work things out. This is of course a very special trick,
- but it IS useful, and it shows NO GC strategy always wins unless the
- programmer explicitly can tell what objects are live/dead, but then
- again, we're back to explicit memory management.
-
- Niklas
-
- --
- Niklas Hallqvist Phone: +46-(0)31-40 75 00
- Applitron Datasystem Fax: +46-(0)31-83 39 50
- Molndalsvagen 95 Email: niklas@appli.se
- S-412 63 GOTEBORG, Sweden mcsun!seunet!appli!niklas
-