home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / cplus / 12429 < prev    next >
Encoding:
Internet Message Format  |  1992-08-17  |  1.5 KB

  1. 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
  2. From: niklas@appli.se (Niklas Hallqvist)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Garbage Collection for C++
  5. Message-ID: <2009@appli.se>
  6. Date: 16 Aug 92 01:10:05 GMT
  7. References: <1992Aug6.014619.2111@ucc.su.OZ.AU>     <DAVEG.92Aug13025629@synaptx.synaptics.com>     <1992Aug14.021547.15215@news.mentorg.com> <DAVEG.92Aug14194411@synaptx.synaptics.com>
  8. Organization: Applitron Datasystem AB, GOTHENBURG, SWEDEN
  9. Lines: 19
  10.  
  11. I just wanted to say that conservative GC won't really help in all
  12. situations.  Jonathan Shapiro taught me this useful trick once.
  13. When you want to do a doubly linked list to the cost of a singly
  14. linked one (i.e. in mem. space).  Instead of having two pointers
  15. for the link in each node, take the "previous" and "next" pointers
  16. and XOR them, and store the result!  Now you just need to store two
  17. entry consecutive points into the list, and make an iterator intelligent
  18. enough to work things out.  This is of course a very special trick,
  19. but it IS useful, and it shows NO GC strategy always wins unless the
  20. programmer explicitly can tell what objects are live/dead, but then
  21. again, we're back to explicit memory management.
  22.  
  23. Niklas
  24.  
  25. -- 
  26. Niklas Hallqvist    Phone: +46-(0)31-40 75 00
  27. Applitron Datasystem    Fax:   +46-(0)31-83 39 50
  28. Molndalsvagen 95    Email: niklas@appli.se
  29. S-412 63  GOTEBORG, Sweden     mcsun!seunet!appli!niklas
  30.