• Advertisement
Sign in to follow this  

Sfml.net Memory Release

This topic is 629 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So, I know that you have to explicitly release Textures, Fonts and SoundBuffers... but do I have to explicitly release Sprites, TextWriters and Sounds?

 

 

 

For example  which Release function (if any) are correct,

<Somewhat psuedo code>

Class c{
 
 c(){
   Texture T=new Texture("filename")
   Sprite s=new Sprite(T)
 }
 
  Release_A()
{
  s.Dispose();
}
 
 Release_B()
{
  T.Dispose();
   s.Dispose();
}
 
 Release_C()
 {
    T.Dispose();
     s.Texture.Dispose();
     s.Dispose();
 }
 
 Release_D()
 {
    T.Dispose();
 }
}

Additionally, assuming that I have a AssetManager such as

class AssetManager{
   Dictionary<String,Texture> textures;
 
     LoadTexture(filename, alias){
     if (!textures.containskey(alias))
        LoadTexture(file, alias){ textures.Add(alias, new Texture(file));
  }
    GetTexture(alias)
  {
     return textures[alias]; 
  }
}

Then every texture used is Always obtained by 1) Loading it into the asset manager, then 2) retreiving it from asset manager

 

Do I need to release the Textures from each individual sprite, or can i just release the textures in the asset manager?

Edited by Paragon123

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement