[gclist] Re: gclist-digest V1 #41

David Chase chase@centerline.com
Thu, 18 Apr 96 17:44:23 -0400


> > Does anyone know if the C++ standards committee, X3J16, is considering
> > any proposals or entertaining discussions on adding garbage collection
> > to C++?

bobduff@world.std.com (Robert A Duff) writes:

> How does one add garbage collection to a *language*?  Suppose the C++
> standard say, "an implementation of C++ shall support gc".  Can you
> write a test case that determines whether an alleged implementation
> obeys the rule?

The Boehm-Weiser collector comes with such a test case.  Typical
test cases include:

for <many iterations> do
  construct a big hairy graph of heap-allocated nodes from scratch
  manipulate it a lot
  drop it on the floor
end

To test for the existence of a garbage collector, there has to be 
a small number of iterations after which the resource consumption 
of the program grows very slowly, if at all.

> IMHO, gc is an implementation issue.

I disagree, for two reasons.  The degreee of difference between GC'd 
and not GC'd is extraordinary -- without GC, there are many programs 
that will simply not run, because they run out of memory. That is, 
the amount of time that you can run the progam is bounded by how 
much memory you have.  The existence of GC removes that linkage. 
Second, with GC, you write different programs and libraries, because 
you don't need to fool with memory allocation.

> To put gc in a *language definition*, one would need a model of storage
> usage that is far more detailed than is typical.

I think it would be a useful exercise, and now that I think about 
it, not incredibly difficult, either.

David