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

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!sun-barr!ames!agate!tfs.com!tfs.com!eric
  3. From: eric@tfs.com (Eric Smith)
  4. Subject: Re: Garbage Collection for C++
  5. Message-ID: <1992Aug15.015237.17711@tfs.com>
  6. Organization: TFS
  7. References: <DAVEG.92Aug13025629@synaptx.synaptics.com> <1992Aug14.021547.15215@news.mentorg.com> <TMB.92Aug14130323@arolla.idiap.ch>
  8. Date: Sat, 15 Aug 1992 01:52:37 GMT
  9. Lines: 37
  10.  
  11. In article <TMB.92Aug14130323@arolla.idiap.ch> tmb@idiap.ch writes:
  12. >What "hits"? In all the cases that I have looked at, the GC overhead
  13. >has been _smaller_ than the overhead of explicit memory management in
  14.  
  15. Explicit memory management functions have traditionally favored memory
  16. economy over speed.  That was because memory was very expensive.  But
  17. now that memory prices have fallen through the floor, e.g. from $4000
  18. per megabyte in 1983 to $25 per megabyte in 1992, it no longer makes
  19. much sense to waste cpu time to save memory.
  20.  
  21. One easy trick to get around the slowness of obsolete memory management
  22. functions is to allocate memory in bigger chunks and then parcel it out
  23. to individual objects using the fastest algorithm possible.  For example,
  24. if your program typically allocates 10000 500-byte blocks, you can have
  25. it allocate 500000 bytes at a time and parcel them out as needed, and
  26. allocate another 500000 bytes when those are exhausted.
  27.  
  28. Comparing GC overhead with obsolete memory allocation functions doesn't
  29. make GC look good.  The advantages of GC are overwhelming, but so are
  30. the disadvantages, and that's why it almost seems like a religious
  31. issue now.
  32.  
  33. The main advantage of GC is that it simplifies programs and makes them
  34. easier to maintain.  This is a very substantial advantage, worth
  35. sacrificing a lot for.  But, if non-GC memory management can obtain
  36. nearly the same advantage, without the disadvantages of GC, then the
  37. sacrifices aren't necessary.  So, the question would be, how can non-GC
  38. memory management gain the advantage of simplifying programs and making
  39. them easier to maintain, to approximately the same extent that GC gains
  40. that advantage?
  41.  
  42. One answer would be that modern programming languages, using OOP and
  43. genericity, make complexity so much easier to manage that the complexity
  44. of non-GC memory management is no longer anywhere near as big a problem
  45. as it was with older languages.  OOP and genericity have almost unlimited
  46. potential to simplify complex software, to the point where the additional
  47. simplification provided by GC might become superfluous.
  48.