[SDL] Memory Leak
Ken Rogoway
Ken at HomebrewSoftware.com
Thu Sep 13 20:46:17 PDT 2007
-----Original Message-----
From: sdl-bounces at lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On
Behalf Of Manuel Lopez Blasi
Sent: Thursday, September 13, 2007 10:28 PM
To: sdl at libsdl.org
Subject: [SDL] Memory Leak
Hi,
i'm making my little program, kinda remake of robocop arcade bonus stage.
I noticed a memory leak when i call my function "calcular_render", grabbing
200 kb /second. I dunno what might be the cause. Any ideas? Thanks in
advance, here's the complete code (I'm working in DevCpp):
-----------------------------------------------
The problem is pretty obvious. In your calcular_render() function you call
SDL_LoadBMP() 11 times, but only free one of the images you load. Move your
call to SDL_FreeSurface(imagen); right after you call
SDL_BlitSurface(imagen, NULL, cuadro_princi.screen, &dest);
That will fix the leak.
Ken Rogoway
Homebrew Software
http://www.homebrewsoftware.com/
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.487 / Virus Database: 269.13.16/1005 - Release Date: 9/13/2007
11:45 AM
More information about the SDL
mailing list