Christian Br?nnum-Hansen wrote:
I am making a game in C++ using SDL.
But I have this big problem.
It just takes more and more memory as it runs.
It can be downloaded at:
http://www.caturn.dk/newgame.html
Does anyone have the slightest idea what the problem could be?
It does'nt declare any new variables while it runs (only in the start)
but changes the ones already declared.
Rewrite your project from scratch, using "test driven development". Then you
can instrument each test to detect leaks, and the test will tell you what
subset of code's doing it.
If you simply must persist with the current code, cut it in half and see
which half leaks. Keep going until you have a very small code sample that
leaks. If you still can't see the leak, post that snip here.
Alternately, look up one of the (off-topic) heapwalk() functions, put it
into a function called "detectLeak()", and call that function everywhere.
Put a breakpoint in it, and see which code first becomes leaky.
Alternately, get a leak detector such as (IIRC) "electric fence", or
similar.
But asking all of us to read all of your code is very inefficient, unless
you - who are more familiar with the code - does some preparation first.
--
Phlip
http://www.xpsd.org/cgi-bin/wiki?Tes...UserInterfaces