crystal clear()

Steven Schveighoffer schveiguy at yahoo.com
Fri Sep 17 15:38:34 PDT 2010


On Fri, 17 Sep 2010 18:31:45 -0400, Sean Kelly <sean at invisibleduck.org>  
wrote:

> Steven Schveighoffer Wrote:
>
>> On Fri, 17 Sep 2010 18:11:11 -0400, Steven Schveighoffer
>> <schveiguy at yahoo.com> wrote:
>>
>> > On Fri, 17 Sep 2010 18:07:54 -0400, Andrei Alexandrescu
>> > <SeeWebsiteForEmail at erdani.org> wrote:
>> >
>> >> On 09/17/2010 04:55 PM, Steven Schveighoffer wrote:
>> >>> On Fri, 17 Sep 2010 17:33:11 -0400, Andrei Alexandrescu
>> >>> <SeeWebsiteForEmail at erdani.org> wrote:
>> >>>
>> >>>> I think clear() can be fixed if we remove the call to the  
>> constructor
>> >>>> AND obliterate the vptr.
>> >>>
>> >>> agreed.
>> >>
>> >> One more thing: we need to change the call to the destructor to check
>> >> the vptr. If the vptr is null, no call to the destructor. Where is  
>> that
>> >> piece of code? Couldn't find it by grepping for __dtor.
>> >
>> > lifetime.d?  Looks like it might already check for null classinfo ;)
>> >
>> >  
>> http://www.dsource.org/projects/druntime/browser/trunk/src/rt/lifetime.d#L1002
>>
>> However, it does look like we will have to kill the monitor in clear().
>
> Is there some reason clear() can't just call rt_finalize?

does rt_finalize not deallocate the memory?  If so, that's probably the  
right thing to do.  In fact, I think it does exactly what we want.  It  
calls collectHandler, what does that mean?

I'm thinking you are right.  Why didn't you speak up before I went through  
all this trouble? ;)

-Steve


More information about the Digitalmars-d mailing list