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

  1. Path: sparky!uunet!synaptx!synaptics.com!daveg
  2. From: daveg@synaptics.com (Dave Gillespie)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Garbage Collection for C++
  5. Message-ID: <DAVEG.92Aug20022559@synaptx.synaptics.com>
  6. Date: 20 Aug 92 09:25:59 GMT
  7. References: <1992Aug6.014619.2111@ucc.su.OZ.AU>
  8.     <DAVEG.92Aug13025629@synaptx.synaptics.com>
  9.     <TMB.92Aug16164940@arolla.idiap.ch>
  10.     <1992Aug18.021453.24394@news.mentorg.com>
  11.     <DAVEG.92Aug17224359@synaptx.synaptics.com> <boehm.714158406@siria>
  12. Sender: daveg@synaptx.Synaptics.Com
  13. Organization: Synaptics, Inc., San Jose, CA
  14. Lines: 63
  15. In-reply-to: boehm@parc.xerox.com's message of 18 Aug 92 17:20:06 GMT
  16.  
  17. In article <boehm.714158406@siria> boehm@parc.xerox.com (Hans Boehm) writes:
  18. >> But the test for whether or not a pointer points *somewhere* in the
  19. >> GC-able zone of memory is trivial.
  20.  
  21. > This is highly system dependent.  In the latest versions of our collectors,
  22. > things may well be the other way around.  You generally can't assume
  23. > contiguity of the garbage collected heap.  You also don't really
  24. > want any bookkeeping information on the pages of the garbage collected
  25. > heap.  That way a page containing pointerfree objects is never touched
  26. > during a collection.  Neither is an entirely empty page.  Thus we find out
  27. > whether a page is in a GC-able zone by a lookup in a two-level tree.
  28.  
  29. I was actually thinking of this as within the bounds of "trivial,"
  30. in the sense that one or maybe two fast memory lookups per pointer
  31. validation is probably fast enough not to both anyone, especially
  32. if, as you point out, the lookups are in a single table somewhere
  33. rather than spread all throughout virtual memory.
  34.  
  35. > Determining whether a pointer points to the beginning of a small object
  36. > doesn't really require a mod operation.  (We stopped doing that when
  37. > we moved to machines with a really slow mod operation.)  There are typically
  38. > a small number of distinct small object sizes.  You simply precompute
  39. > a layout map for pages for each size.  [...]
  40.  
  41. Of course that's the way to do it; I should have put a little more
  42. thought into it before posting.
  43.  
  44. You could also just round object sizes like 12 up to 16, and then
  45. use bitwise operations.
  46.  
  47. > In general, aside from anomalies like slow mod operations, I conjecture that
  48. > an important complexity measure for all of these algorithms is the number
  49. > of cache misses.  [...]
  50.  
  51. All these page tables and layout maps would wind up in cache, which
  52. is a big plus.
  53.  
  54. >>> [questioning why one would ever need to do explicit deletes]
  55.  
  56. >> Significant reduction in the number of GC's!  [Manually deleting
  57. >> some objects means GC-inducing junk accumulates more slowly.]
  58.  
  59. > Presumably you're really worried about pause times, and frequency of pauses.
  60. > That's usually a valid concern, but in the presence of concurrent or
  61. > incremental collection, things become less clear.  Even in the presence
  62. > of generational collection, it may not buy you much if the short-lived
  63. > objects are the ones that are being handled manually.
  64.  
  65. Do you really think incremental or generational collectors are
  66. feasible in C++?  I've never looked in the guts of one of these
  67. collectors, but as I understand it they tend to depend on the
  68. ability to move data around, and other things that a C++ collector
  69. might not be able to get away with.  (C++'s use of pointers is so
  70. unrestricted that it's a minor miracle it's possible to do garbage
  71. collection at all...)
  72.  
  73. I would love to be proved wrong in this guess!
  74.  
  75.                                 -- Dave
  76. --
  77. Dave Gillespie
  78.   daveg@synaptics.com, uunet!synaptx!daveg
  79.   or: daveg@csvax.cs.caltech.edu
  80.