Sign in to follow this  
zike22

Memory problem??

Recommended Posts

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

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
"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

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this