|Adding garbage collection to C++ Dain.Samples@UC.EDU (1992-08-11)|
|Re: Adding garbage collection to C++ firstname.lastname@example.org (1992-08-12)|
|Re: Adding garbage collection to C++ email@example.com (1992-08-13)|
|Re: Adding garbage collection to C++ firstname.lastname@example.org (1992-08-13)|
|Re: Adding garbage collection to C++ email@example.com.OZ.AU (1992-08-14)|
|Re: Adding garbage collection to C++ firstname.lastname@example.org (1992-08-14)|
|Re: Adding garbage collection to C++ email@example.com (1992-08-14)|
|Re: Adding garbage collection to C++ firstname.lastname@example.org (1992-08-14)|
|[9 later articles]|
|From:||email@example.com (Thomas M. Breuel)|
|Organization:||IDIAP (Institut Dalle Molle d'Intelligence Artificielle Perceptive)|
|Date:||Wed, 12 Aug 1992 16:50:12 GMT|
I have reached the conclusion that only conservative garbage collection
allows no changes to the existing language [C or C++].
Why have you reached that conclusion? As far as I can tell, ANSI-C and C++
are both fully garbage collectable within the current language standard.
More precisely, I believe that you could compile ANSI-C to portable and
idiomatic CommonLisp (the main difficulty is pointers to automatic
I added three additional keywords: collected, heap, and embedded. The
latter keyword is used to declare pointers that can be used to point into
objects that are collected, and the other two are used to declare
collectible objects and allow the programmer to allocate normally gc'd
objects on the heap.
I don't understand why there is this desire to keep supporting the "usual"
malloc/free style heap allocation once you have garbage collection (the
functions themselves should, of course, continue to exist, with "malloc"
allocating storage and "free" becoming a NOOP).
I have never found malloc/free style storage management to be faster than
a good GC, and as far as I can tell, you never want unreferenced data to
hang around if you have so little memory left that you need to call a
garbage collection. For really daring programmers, you could provide some
primitive "unsafe_free" that returns storage immediately and regardless of
whether there are still references.
[I'd be interested how you trace through unions containing pointers. -John]
Return to the
Search the comp.compilers archives again.