Giving memory back to the system
-
I have an app that eats up a bunch of memory with objects (created with "new"), then releases it back to the system (using "delete"). I am monitoring the memory usage with taskmanager, and noticed something strange... the memory does not seem to be given back to the system. If I minimize the app, the memory is magically recovered by the system, and all is well, even after restoring the app. Is the memory actually given back, but taskmanager is just out of the loop until the minimize, or is the memory not released until the app is minimized? if so, am I supposed to call some sort of "flush" function to give it back? Thanks
-
I have an app that eats up a bunch of memory with objects (created with "new"), then releases it back to the system (using "delete"). I am monitoring the memory usage with taskmanager, and noticed something strange... the memory does not seem to be given back to the system. If I minimize the app, the memory is magically recovered by the system, and all is well, even after restoring the app. Is the memory actually given back, but taskmanager is just out of the loop until the minimize, or is the memory not released until the app is minimized? if so, am I supposed to call some sort of "flush" function to give it back? Thanks
MS's memory manager is greedy. it hangs onto memory you've free'd in anticipation that you might need it again before your program exits. this makes subsequent allocations faster.
-
I have an app that eats up a bunch of memory with objects (created with "new"), then releases it back to the system (using "delete"). I am monitoring the memory usage with taskmanager, and noticed something strange... the memory does not seem to be given back to the system. If I minimize the app, the memory is magically recovered by the system, and all is well, even after restoring the app. Is the memory actually given back, but taskmanager is just out of the loop until the minimize, or is the memory not released until the app is minimized? if so, am I supposed to call some sort of "flush" function to give it back? Thanks
nadiric wrote:
...the memory does not seem to be given back to the system.
Right, and this is perfectly normal behavior.
nadiric wrote:
...but taskmanager is just out of the loop...
TM is actually showing you the address space in use. This has nothing to do with the amount of that address space your program is actually using.
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
-
I have an app that eats up a bunch of memory with objects (created with "new"), then releases it back to the system (using "delete"). I am monitoring the memory usage with taskmanager, and noticed something strange... the memory does not seem to be given back to the system. If I minimize the app, the memory is magically recovered by the system, and all is well, even after restoring the app. Is the memory actually given back, but taskmanager is just out of the loop until the minimize, or is the memory not released until the app is minimized? if so, am I supposed to call some sort of "flush" function to give it back? Thanks