Sign in to follow this  

re-assigning SDL Surfaces

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

Hey there, I was just wondering if it was unwise to re-assign an SDL Surface like this:
SDL_Surface * mySurface;
mySurface = SDL_LoadBMP("foo.bmp");

// do stuff here

mySurface = SDL_LoadBMP("goo.bmp");

Is that, like, memory leak city or does SDL take care of it for me?

Share this post


Link to post
Share on other sites
Quote:
Original post by rip-off
SDL will not take care of it for you. its very lazy...

use SDL_FreeSurface( /*surface to be freed*/ ); when you are done using a surface. but dont use it on the video surface.


Ditto.

You... you... LAZY API! *Points to SDL!*

It won't free it because it might not be the root pointer, it might be a pointer to something else that is pointed to by another pointer. If it was deleted, the other pointer would point to the one-way ticket to garbage-land.

DO NOT use it on your main surface!

Share this post


Link to post
Share on other sites

This topic is 4337 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this