Finalize GC memory

Jonathan M Davis jmdavisProg at gmx.com
Sun Jun 16 14:23:28 PDT 2013


On Sunday, June 16, 2013 12:24:40 Ali Çehreli wrote:
> On 06/15/2013 02:22 PM, Namespace wrote:
>  > With the knowledge that 'delete' will be deprecated soon:
>  > Is there then still a way to finalize GC memory? I know it's unsafe etc.
>  > but is there a way? I know of 'destroy' but it does not finalize
>  > anything and AFAIK it's not safe and has also side effects.
> 
> Being a C++ programmer, I am new to the term "finalize". If it means
> "call the destructor", then destroy() is it.

http://en.wikipedia.org/wiki/Finalizer

It's basically just means calling the finalizer, and D conflates finalizers and 
destructors, so the destructor of any object on the GC heap is that object's 
finalizer. Normally, it's called when the object is collected, but it can get a 
bit messy depending on how the GC works. It's essentially a non-determinstic 
destructor though.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list