Memory leak or not?

Started by
0 comments, last by BradDaBug 22 years, 1 month ago
I have a little program monitoring how much free memory my computer has. As my game runs, it appears that very slowly, memory is being used, but not freed. I can find no fault in the code. Upon exiting, all memory used appears to be freed. Is this just a thing with Windows, or does my game have leaks?
I like the DARK layout!
Advertisement
"leak" is a subjective term. Your program appears to not have the loosest description of a leak, in that when you exit all memory is freed. However, if your program accrues more and more memory as it goes on, this can also be considered a leak, and is definitely a problem; given small enough memory and long enough program runtime, your program will crash. You might think of it as a memory "creep" rather than leak.

As an example, think of an MP3 player that sends buffers of sound to the sound card, but never frees them until the program exits. Given long enough time, the program will eventually fail to allocate a new buffer and crash. This appears to be the same behavior that''s in your program, but probably not so pronounced.

MS has some memory debugging routines that will let you take a memory snapshot at two different times and compare what''s different, but I haven''t had much luck in looking at it. If you can''t identify just by thinking about it what might be getting more and more memory, you mightwnat to look into these APIs (I believe they all start with _CrtDebug or something like that).

This topic is closed to new replies.

Advertisement