Eliminate class allocators and deallocators?

Leandro Lucarella llucax at gmail.com
Tue Oct 6 17:26:18 PDT 2009


Andrei Alexandrescu, el  6 de octubre a las 11:01 me escribiste:
> Hello,
> 
> 
> D currently allows defining class allocators and deallocators. They
> have a number of problems that make them unsuitable for D 2.0. The
> most obvious issue is that D 2.0 will _not_ conflate destruction
> with deallocation anymore: invoking delete against an object will
> call ~this() against it but will not recycle its memory.

I don't think it is a good idea (GC-wise) to say that in the specs.
I think the GC implementor should be free to decide if a delete really
free the memory or not. Some collectors can do this very naturally (like
the current one) and some others don't (like allocators that uses
pointer-bump allocation). I think the language should divide destruction
and deallocation, but I don't think is a good idea not to notify the GC at
all when delete is used. I think the GC should be able to do whatever it
feels is good for him (so the user should not rely either on the memory
being actually freed or otherwise).

-- 
Leandro Lucarella (AKA luca)                      http://llucax.com.ar/
----------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------
If you don't know what direction you should take
You don't know where you are



More information about the Digitalmars-d mailing list