when is the object destuctor called?

Johan Granberg lijat.meREM at OVEgmail.com
Mon May 22 07:49:50 PDT 2006


I came across this sentence in the specification

"The garbage collector is not guaranteed to run the destructor for all 
unreferenced objects."

This made me wonder in what circumstances the destructor WONT bee called.
Basically I want to do this: An object stores a OpenGL texture (uint) 
and when the object gets collected/deleted I want to free the texture. I 
don't care about if the destructor will bee called on program exit, but 
I need some mechanism for freeing the textures during normal execution 
to prevent a video memory leak.

So I need to know if I can trust the destructor to do this or it their 
is some other mechanism I can use.



More information about the Digitalmars-d mailing list