Garbage Collector : Ignoring a reference

ag0aep6g via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Apr 26 06:44:56 PDT 2016


On 26.04.2016 15:35, Begah wrote:
> Nothing will reload.
>
> An example :
> I load a texture "button.png" in a class and draw it to the screen,
> When the screen switches to another screen ie from menu to the game,
> I want that the "button.png" texture is automaticly destroyed by the gc.
> But this will never happen because i still have a reference to it in my
> hashmap.
> Thus, i need a way to tell the gc to ignore the reference ( or something
> similar ) in that hashmap.

How would you prevent reads of that now-invalid element of the hashmap?


More information about the Digitalmars-d-learn mailing list