GC vs Resource management.

via Digitalmars-d digitalmars-d at puremagic.com
Sat May 3 07:43:56 PDT 2014


On Saturday, 3 May 2014 at 14:31:59 UTC, Paulo Pinto wrote:
> - Make all scene graph nodes IDisposable.
>
> - Have a using(rootNode) {} on your render loop

That would work for a static scene.

But you want to mark resources ready for release when nodes are 
removed from the graph dynamically. In most cases shared pointers 
(ref counting) would work, but if you allow "fractal" recursion 
then you will get cycles. (e.g. 
meshnode->scaleRND->rotateRND->stopIfTooSmall->meshnode )


More information about the Digitalmars-d mailing list