Jump to content
  • Advertisement
Sign in to follow this  
fathom88

Silly Question On Windows Memory Allocation Again

This topic is 5068 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've been debugging what I thought was a memory leak. My application starts out at X value for memory usage (based on CTRL-Alt Del in WIN to look at the processes). When I look at it again, it is Y value. My app is interactive and executes different sections of code depending on the situation. For instance, let's say it needs to perform a specific task, the memory usage goes up. Yet, if it performs the same task again, the memory does not go up. Hence, if differnt tasks are never performed the memory does not go. The memory is different at different points in time based on the tasks performed. Would this be a correct anaylsis of the situation? If true, why is this so in WIN. If I declare some int's in a function (not dynamically mind you, just "int x = 4;"), shouldn't WIN reclaim the memory after I exit the function. I'm sorry to ask the question again. Thanks.

Share this post


Link to post
Share on other sites
Advertisement
The stack grows automatically and is never shrunk.
Calling different routines may cause their code to paged into RAM from disk. This memory is paged back out to disk when the OS decides that it hasn't been used for "a while".
Read up on virtual memory.

Share this post


Link to post
Share on other sites
That the worst way to see if your application leaks memory. Either use crt memory debug functions or something like fluid studios memory manager.

Share this post


Link to post
Share on other sites
Windows task manager gives very unreliable numbers on memory use.

If you don't use any new's and alloc/malloc's you can't have a memory leak.

The most lowtech way to find out if you have a memory leak in your application is to have it running for a very long time (hours & days) and do stuff with it. If the memory use reported by the task manager reports a very high value, than you very likely have a memory leak. the smaller the mem leak, the longer it takes to see any effect.

There are several tools out there to check for memory leaks in your application, altough there's none I can.

Hope that helps...

[Edited by - Rattenhirn on December 6, 2004 3:47:55 AM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!