[SDL] Can´t_Init_SDL_:_no_available_video_device

Sam Lantinga slouken at devolution.com
Sun Jan 19 16:14:01 PST 2003


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Monday 06 January 2003 16:50, Roger D. Vargas wrote:
> On Sat, 4 Jan 2003, Matt Borkowski wrote:
> > In the loadimg() function you do
> > tmp=SDL_LoadBMP("sail.bmp");
> > without first freeing tmp from when you loaded
> > "backg.bmp".
>
> Does it matters? The example runs without segfaults.

Yes, it does matter. If you don't free a surface, you'll get a memory leak, 
i.e. the memory used up by the earlier bitmap "backg.bmp" will remain 
allocated. It will only be reclaimed by the OS once your program ends.

Memory leaks are obviously bad because you might run out of memory simply 
because to many no-longer-used but still allocated blocks of memory are 
around.

cu,
Nicolai
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+GayTsxPozBga0lwRAskJAJ0UYATdZz5EEEUu81eTy6HiKECMqwCdHZrN
MCDPxySF03lLSQsACMDBr2Y=
=+E8/
-----END PGP SIGNATURE-----





More information about the SDL mailing list