Memory problem??

Started by
3 comments, last by zike22 18 years, 7 months ago
The game I've been programming compiles fine but sometimes freezes when I run it. I then get the message that I'm running low on memory and that windows wants to increase the size of my virtual memory. Now I seriously doubt that my (not even at demo stage) game requires that much horsepower. My laptop has slighty above avrage gaming specs, I dont notcie the problem on my desktop (which has better specs then my laptop). So I'm thinking theres some type of memory leak or something, this happen to anyone else?? Any suggestions, tips, or ideas?? Thanks
------------------------------------------------------------------------------------------- My Email: [email=zike22@aol.com]zike22@aol.com[/email] - My AIM: zike22@AIM
"Facts are chains that bind perception and fetter truth. For a man can remake the world if he has a dream and no facts to cloud his mind." - The Emperor, WarHammer 40K
Advertisement
It sounds like you have an infinite loop that is allocating memory, or a recursive function that never stops. What happens when you step through the code in the debugger?
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
"step through the code in the debugger?". I'm not really sure what you mean by that. When I compile I tons of errors about printing text to the screen for some reason. I dindt get them before but when I updated Allegro i started receving them, but the program compiles just fine w/ the exception of those errors
------------------------------------------------------------------------------------------- My Email: [email=zike22@aol.com]zike22@aol.com[/email] - My AIM: zike22@AIM
"Facts are chains that bind perception and fetter truth. For a man can remake the world if he has a dream and no facts to cloud his mind." - The Emperor, WarHammer 40K
are you using windows? if so you can add this to the start of your program...

_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );

this will track your memory allocations and report all memory that was not released when your program exits. If you use visual studio, run your program in the debugger (f5) and then exit your program normally. All the leaks will print out in the output window with allocation numbers next to them.

You can then use CrtSetBreakAlloc( allocNumber ); to have visual studio break when that part of memory is allocated.

Doing this and cleaning up all your memory leaks will probably also help you clean up runtime leaks that are continually building up.

hope that was some help to you
Yo AP thanks a lot.
------------------------------------------------------------------------------------------- My Email: [email=zike22@aol.com]zike22@aol.com[/email] - My AIM: zike22@AIM
"Facts are chains that bind perception and fetter truth. For a man can remake the world if he has a dream and no facts to cloud his mind." - The Emperor, WarHammer 40K

This topic is closed to new replies.

Advertisement