current GC behavior

Ali Çehreli acehreli at yahoo.com
Tue Nov 6 09:00:51 PST 2012


On 11/06/2012 03:27 AM, luka8088 wrote:

 > I was writing some unit tests and I also wanted to test that in certain
 > cases object references are properly removed everywhere so that GC can
 > collect them in order to make sure there is no memory leak. While trying
 > to achieve this I learned that objects are not always collected at the
 > time I would expect them to, so I documented current behavior and some
 > tips.

Thanks for the analysis and the tips but they all depend on observations 
made by a particular test program on a particular version of a 
particular compiler. It is conceivable that even the same GC algorithm 
can behave differently in another program.

In fact, some objects may never be collected even if there are no more 
references to them.

In comparison, destroy() and scoped() do call the destructors at precise 
times.

Ali



More information about the Digitalmars-d-learn mailing list