Re: Garbage Collector : Ignoring a reference

2016-04-30 Thread Guillaume Piolat via Digitalmars-d-learn
On Tuesday, 26 April 2016 at 09:07:59 UTC, Begah wrote: I am trying to create an asset manager for my textures. I had the idea ( it may be a wrong idea ) to create a hashmap of my textures with a string as the key. When the program request a texture, it firts check if it is in the hashmap and t

Re: Garbage Collector : Ignoring a reference

2016-04-30 Thread Namespace via Digitalmars-d-learn
On Tuesday, 26 April 2016 at 09:07:59 UTC, Begah wrote: I am trying to create an asset manager for my textures. I had the idea ( it may be a wrong idea ) to create a hashmap of my textures with a string as the key. When the program request a texture, it firts check if it is in the hashmap and t

Re: Garbage Collector : Ignoring a reference

2016-04-26 Thread Marco Leise via Digitalmars-d-learn
Am Tue, 26 Apr 2016 13:35:37 + schrieb Begah : > 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. My ideological point of view is that you must not use non-deterministic garbage collection for

Re: Garbage Collector : Ignoring a reference

2016-04-26 Thread ciechowoj via Digitalmars-d-learn
Thus, i need a way to tell the gc to ignore the reference ( or something similar ) in that hashmap. So, having pointer that doesn't hold a reference isn't that hard (store it in memory region that is unreachable to gc), but don't you need a way to tell if that pointer ins't dangling, beyond i

Re: Garbage Collector : Ignoring a reference

2016-04-26 Thread ag0aep6g via Digitalmars-d-learn
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 neve

Re: Garbage Collector : Ignoring a reference

2016-04-26 Thread Begah via Digitalmars-d-learn
On Tuesday, 26 April 2016 at 13:01:26 UTC, ciechowoj wrote: On Tuesday, 26 April 2016 at 09:07:59 UTC, Begah wrote: How could i tell the garbage collector to ignore the reference in the hashmap and to free it if there isn't any other reference that in my hashmap? You could always zero the ref

Re: Garbage Collector : Ignoring a reference

2016-04-26 Thread ciechowoj via Digitalmars-d-learn
On Tuesday, 26 April 2016 at 09:07:59 UTC, Begah wrote: How could i tell the garbage collector to ignore the reference in the hashmap and to free it if there isn't any other reference that in my hashmap? You could always zero the reference in the hashmap, as it won't be valid after reload any

Re: Garbage Collector : Ignoring a reference

2016-04-26 Thread Alex Parrill via Digitalmars-d-learn
On Tuesday, 26 April 2016 at 09:07:59 UTC, Begah wrote: I am trying to create an asset manager for my textures. I had the idea ( it may be a wrong idea ) to create a hashmap of my textures with a string as the key. When the program request a texture, it firts check if it is in the hashmap and t

Garbage Collector : Ignoring a reference

2016-04-26 Thread Begah via Digitalmars-d-learn
I am trying to create an asset manager for my textures. I had the idea ( it may be a wrong idea ) to create a hashmap of my textures with a string as the key. When the program request a texture, it firts check if it is in the hashmap and then returns if it is : Texture[string] textures; Text