Created
September 10, 2012 16:34
-
-
Save eternalstorms/3691979 to your computer and use it in GitHub Desktop.
Activity Monitor memory usage is inaccurate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Monitoring your memory usage with Activity Monitor is pretty unreliable. First, which memory field are you watching (Virtual Private Memory, Real Private Memory, Real Shared Memory, or Real Memory)? | |
Second, when your code makes an allocation request, that typically goes, directly or indirectly, to the malloc routines. The malloc routines try to satisfy your request from the memory that it already has. If it can't then it requests more from the system. When you free memory, it goes back to malloc. Malloc does not necessarily return it to the system. It may keep it to more quickly satisfy future requests. So, you may not see your process's memory usage go down, at least not all the way, even if your program is releasing everything it allocated. | |
The proper way to check that your program is managing memory correctly is to use Instruments with the Leaks and Allocations tools. | |
(source: http://stackoverflow.com/questions/10218314/cocoa-memory-issue-memory-doesnt-get-reclaimed-when-objects-are-removed-from-a ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment