Jump to content
  • Advertisement
Sign in to follow this  
Paragon123

Sfml.net Memory Release

This topic is 720 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
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!