Finding Memory Leaks of Legend of Tux: Difference between revisions
Levidsmith (talk | contribs) (Created page with 'Helpful way to find memory leaks under Windows. First, start Task Manager (Ctrl-Alt-Delete => Start Task Manager) Click the Processes tab Start your application, and the name …') |
Levidsmith (talk | contribs) No edit summary |
||
Line 1: | Line 1: | ||
Here is a process I used to resovle a memory leak in The Legend of Tux. | |||
This is a helpful way to find memory leaks under Windows. | |||
First, start Task Manager (Ctrl-Alt-Delete => Start Task Manager) | First, start Task Manager (Ctrl-Alt-Delete => Start Task Manager) | ||
Line 18: | Line 20: | ||
I quit the stage, return to the title screen, and select another stage, which increases the memory used to 168 M. | I quit the stage, return to the title screen, and select another stage, which increases the memory used to 168 M. | ||
Since the memory | Since the memory increases occur when a new screen is loaded, I have a good clue that makes me believe that the memory leak is due to not freeing the memory used to store the music data buffer. | ||
I checked the audio.c file that I am using to handle the SDL_Mixer commands, added "Mix_FreeMusic(music);" and "music = NULL;" code before the audio is loaded. I recompiled and tried the program again, but the memory still significantly increased between screen. | |||
My next guess is that it is due to the SDL_Surface objects not being free'd. |
Revision as of 07:29, 7 November 2009
Here is a process I used to resovle a memory leak in The Legend of Tux.
This is a helpful way to find memory leaks under Windows.
First, start Task Manager (Ctrl-Alt-Delete => Start Task Manager)
Click the Processes tab
Start your application, and the name of your executable should show up in the list
In the screen below, I see that my program is using 13M of memory, and half the CPU
When I go to the stage select screen, it still uses about half the CPU, but the memory used jumps to 26.5 M
I select a stage, and the memory used again increases to 87M
I quit the stage, return to the title screen, and select another stage, which increases the memory used to 168 M.
Since the memory increases occur when a new screen is loaded, I have a good clue that makes me believe that the memory leak is due to not freeing the memory used to store the music data buffer.
I checked the audio.c file that I am using to handle the SDL_Mixer commands, added "Mix_FreeMusic(music);" and "music = NULL;" code before the audio is loaded. I recompiled and tried the program again, but the memory still significantly increased between screen.
My next guess is that it is due to the SDL_Surface objects not being free'd.