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

  1. Path: sparky!uunet!dtix!darwin.sura.net!wupost!gumby!yale!mintaka.lcs.mit.edu!ai-lab!life.ai.mit.edu!tmb
  2. From: tmb@arolla.idiap.ch (Thomas M. Breuel)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Reference counting for vectors, (Tony Hansen's book).
  5. Message-ID: <TMB.92Aug17173218@arolla.idiap.ch>
  6. Date: 17 Aug 92 21:32:18 GMT
  7. References: <1992Aug14.164719.9719@wuecl.wustl.edu>
  8.     <BRISTER.92Aug14170213@tirade.decwrl.dec.com>
  9.     <1992Aug16.081316.27729@mole-end.matawan.nj.us>
  10. Sender: news@ai.mit.edu
  11. Reply-To: tmb@idiap.ch
  12. Organization: IDIAP (Institut Dalle Molle d'Intelligence Artificielle
  13.     Perceptive)
  14. Lines: 31
  15. In-reply-to: mat@mole-end.matawan.nj.us's message of 16 Aug 92 08:13:16 GMT
  16.  
  17. mat@mole-end.matawan.nj.us writes:
  18.  
  19.    One possibility, at least of some of them, is to make the management of
  20.    the space a function of the `data structure.'  You may have some extra
  21.    objects laying around, but they won't get lost, and there is at least an
  22.    object (the interface object for the data structure as a whole) whose
  23.    lifetime bounds the lifetime of the objects `within.'
  24.  
  25.    These value-is-the-only-thing-of-interest data structures (representation
  26.    schemes) are precisely those for which GC is needed and for which it is
  27.    well-suited.
  28.  
  29.    Meta-discussion:  This seems to me so awfully obvious that it hurts to
  30.    write it every few months, yet it hasn't been refuted (at least not to
  31.    my satisfaction), nor have the conclusions which seem to me obvious been
  32.    accepted.  What am I not seeing?
  33.  
  34. You are not seeing that people may not have the memory for those "few
  35. extra objects" because the lifetime of the containing object may be
  36. much longer than the lifetime of all the bits and pieces that make it
  37. up. In fact, often the "containing object" is simply the whole
  38. program, and its lifetime is until it runs out of memory.
  39.  
  40. Also, you got it backwards. The need for true GC arises precisely when
  41. object identies (pointers, addresses, aliasing) matter. If only the
  42. value of an object matters, you can avoid the need for garbage
  43. collection trivially via copying or reference counting on assignment
  44. and initialization (although a real garbage collector is empirically
  45. still more efficient in most cases).
  46.  
  47.                     Thomas.
  48.