Jump to content
  • Advertisement
Sign in to follow this  
PnP Bios

Unity SDL memory leak?

This topic is 4771 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

Yesterday I was showing off a demo I made in hxRender over in the lounge. You can find that thread here. One interesting thing to note is that even after I commented out all the code that called my library for blitting and image handling, the program was still consuming ram at a small, but incremental rate. I was wondering if anybody else was suffering problems with SDL or SDL with OpenGL contunuously consuming memory?

Share this post


Link to post
Share on other sites
Advertisement
Hmmm... I doubt that there are any serious memory leaks in SDL, since I've heared somewhere that it was used with good results in game servers, and some funny general public usage devices, that by definition, run 24/7. So, if there would be any leaks, those servers/devices would stop working after few days max.

Also, I've heard that SDL was checked with Valgrind in Linux, and no errors were found.

Another argument against possibility of leaks: SDL's maturity.

And one last: my game is using SDL and OpenGL, and it isn't continously consuming RAM :-)


Of course, I may be terribly wrong... that's just my 0.02$ ;-)

Share this post


Link to post
Share on other sites
I've never had a problem with memory leaks. Perhaps you're doing something inappropriate. Check every call you're making that allocates memory and make sure there is a corresponding release of that memory.

Wild guess but are you calling SDL_DisplayFormat() on a surface that you have already allocated memory to?


SDL_Surface* temp = SDL_LoadBMP("someFile.bmp");

// don't do this
// temp = SDL_DisplayFormat(temp);

// do this instead
SDL_Surface* image = SDL_DisplayFormat(temp);

// don't forget to free temp up or else you've got a memory leak
SDL_FreeSurface(temp);

// do something with image
// ...
// ...

SDL_FreeSurface(image);




Chances are it's something else, but it's one possibility. SDL is a rather mature library, i'd be surprised if it was the cause of the leak (I suppose it's a possibility though).

Share this post


Link to post
Share on other sites
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!