How do I do placement delete in D?

Steven Schveighoffer schveiguy at yahoo.com
Wed Dec 15 12:29:10 PST 2010


On Wed, 15 Dec 2010 12:46:34 -0500, Stanislav Blinov <blinov at loniir.ru>  
wrote:

> 15.12.2010 0:05, Craig Black пишет:
>> Thanks Steve.  clear seems to be calling the destructor twice.  Is this  
>> intentional?
>>
>> -Craig
>>
> AFAIR, it's not 'clear()' that calls destructor twice. Some time ago,  
> there has been discussion on how to properly implement clear(). Initial  
> implementation calls dtor, then calls default ctor to leave the object  
> in a meaningful state for the GC to consume. Therefore, when object is  
> being collected, dtor gets called for a second time. The discussion  
> ended on the proposal of nullifying objec't vtbl instead of calling  
> default ctor, which will obviate the need of a second dtor call, but I  
> think this is not currently implemented.

No, the issue is different.  Struct dtors are not called when GC memory is  
collected.  I found the issue.  I just checked in a fix:

http://www.dsource.org/projects/druntime/changeset/451

-Steve


More information about the Digitalmars-d mailing list