[Gc] for C++ GC

Ben Hutchings ben.hutchings at businesswebsoftware.com
Wed Aug 18 07:17:52 PDT 2004


Wei Bing <bwei at dyn.com> wrote:

	I know the following fact:

	class test: gc_cleanup 
	 { 
	 Public: 
	          ~test() 
	          { 
	           ... 
	          } 
	 };

	new test[10];

	But the destructor is only called once not 10 times during
garbage collection.

	Is that correct? 

No, of course it's not correct! It's a bug which should be fixed. If I
understand things correctly, the GC only supports one finaliser per
allocation but gc_cleanup::gc_cleanup tries to register a separate
finaliser for each object and this fails for all but the first in an
array. Either array-new should be disabled in gc_cleanup or gc_cleanup
should somehow chain finalisers for the elements of an array.

Ben.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://napali.hpl.hp.com/pipermail/gc/attachments/20040818/250b0589/attachment.html


More information about the Gc mailing list