reclaiming crashed app memory?

Interesting question...

Well the simple correct direct answer is yes, it reclaimes it immeadiatly. Now the reason that you think that it isn't is actually the interesting part.

All of the memory in your computer is devided up into pages and when a process is killed or exits those pages are freed up. But as an optimization the OS remembers how they were mapped before so if you restart the process it may be possibble to just reuse the information that is already in memory and not reread it all form the disk. These pages do not show up as free althought they are, if they are needed for something else they are used just like free pages.

Another issue that interacts here is that the OS is also free to use "unused" areas of memory as a disk cache. This memory is also not "free" in the statistical sence as reported by top, although it is in parctice. If another application needs more memory then those pages will be allocated, zeroed and the cached data discarded.

Of course top on OS X uses different names for all of these things than the other Unicies in my life so am not totally clear on how these things are labeled here. (Wired = ?)

Hope that helps,

-Eric
 
Wired: non-pageable memory (usually kernel address space, but can belong to a process if such wiring down is requested by mlock, if mlock is really implemented)

Active: valid mapping (points to an existing filesystem or swap object), referenced by an existing process; pageable

Inactive: valid mapping (points to an existing filesystem object), not referenced by any existing process

Free: invalid mapping (e.g. has never been mapped to anything so far, contains modified filesystem object data, etc)
 
Back
Top