GC vs Resource management.

Paulo Pinto via Digitalmars-d digitalmars-d at puremagic.com
Sat May 3 07:32:01 PDT 2014


Am 03.05.2014 16:02, schrieb "Ola Fosheim Grøstad" 
<ola.fosheim.grostad+dlang at gmail.com>":
> On Saturday, 3 May 2014 at 13:21:04 UTC, Paulo Pinto wrote:
>> C# and Java also have scoped blocks (using, try-with-resources),
>> similar to Python for resource management.
>
> Yeah,  but it doesn't work for graphs that maintain resources, such as a
> scene graph which hold onto texture memory. Unfortunately, you don't
> want GC collection to release it either.
>
> I think in most cases resources can either be handled by owned pointers
> or a regional GC (in this case a GC that only trace SceneNodePointers).

Why not?

- Make all scene graph nodes IDisposable.

- Have a using(rootNode) {} on your render loop

--
Paulo


More information about the Digitalmars-d mailing list