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