home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / lang / cplus / 12695 < prev    next >
Encoding:
Text File  |  1992-08-20  |  1.9 KB  |  36 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!microsoft!hexnut!jimad
  3. From: jimad@microsoft.com (Jim Adcock)
  4. Subject: Re: Garbage Collection for C++
  5. Message-ID: <1992Aug20.213720.16599@microsoft.com>
  6. Date: 20 Aug 92 21:37:20 GMT
  7. Organization: Microsoft Corporation
  8. References: <TMB.92Aug16164940@arolla.idiap.ch> <1992Aug18.021453.24394@news.mentorg.com> <DAVEG.92Aug17224359@synaptx.synaptics.com>
  9. Lines: 25
  10.  
  11. In article <DAVEG.92Aug17224359@synaptx.synaptics.com> daveg@synaptics.com (Dave Gillespie) writes:
  12. |In article <1992Aug18.021453.24394@news.mentorg.com> bcannard@hppcb36.mentorg.com (Bob Cannard @ PCB x5565) writes:
  13. |>|> Now, it turns out that in some cases, GC is actually "guaranteed" to
  14. |>|> be faster, in the sense that it can combine very low-cost allocation
  15. |>|> with no overhead deallocation (that is, 0 machine cycles per word).
  16. |
  17. |Well, now, this sounds like the same logic people use to ruin themselves
  18. |with credit cards...  Remember, you still wind up paying (for deallocation),
  19. |just later instead of right away.  But the convenience of paying later,
  20. |and the efficiency of paying in chunks, is a big win.
  21.  
  22. In generation schemes, both long-lived and short-lived objects have
  23. allocation and deallocations costs that are very very small -- IE "0"
  24. There are significant allocation and deallocation costs only for object
  25. that fall in between these two extremes -- objects that live to be middle
  26. aged.  And the cost of these objects is not really the cost of allocating
  27. or deallocating them, but rather the cost of keeping them young.
  28.  
  29. Indirectly, one could argue its the deaths of the short-lived objects that
  30. define the lifetime of a generation, and thus indirectly the short-lived 
  31. objects share a portion of the blame for the costs of the medium-lived
  32. objects.  Still, "0" allocation and deallocation costs for the "typical"
  33. object is a fair description of the behavior one sees in practice --
  34. its only the "atypical" objects that cost you anything significant.
  35.  
  36.