Re: Why is OS X swapping with inactive memory available? (Thomas Backman)
site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Message: 1 Date: Fri, 30 May 2008 21:07:40 +0200 From: Thomas Backman <serenity@exscape.org> Also, FWIW, I didn't mean to whine, but *ask*, in part because I find stuff like this interesting. It has been said before, but maybe not clearly: From: http://developer.apple.com/documentation/Performance/Conceptual/ManagingMemo... --------------------------------- The key point is in inactive memory: 'These pages contain valid data' "I've had a perfectly wonderful evening. But this wasn't it." - Groucho Marx _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... /Thomas --------------------------------- Page Lists in the Kernel The kernel maintains and queries three system-wide lists of physical memory pages: • The active list contains pages that are currently mapped into memory and have been recently accessed. • The inactive list contains pages that are currently resident in physical memory but have not been accessed recently. These pages contain valid data but may be released from memory at any time. • The free list contains pages of physical memory that are not associated with any address space of VM object. These pages are available for immediate use by any process that needs them. When the number of pages on the free list falls below a threshold (determined by the size of physical memory), the pager attempts to balance the queues. It does this by pulling pages from the inactive list. If a page has been accessed recently, it is reactivated and placed on the end of the active list. If an inactive page contains data that has not been written to the backing store recently, its contents must be paged out to disk before it can be placed on the free list. If an inactive page has not been modified and is not permanently resident (wired), it is stolen (any current virtual mappings to it are destroyed) and added to the free list. Once the free list size exceeds the target threshold, the pager rests. So, your inactive memory contents cannot just be 'thrown away' and the physical memory given to someone else. Something has allocated it, may have updated it, but then has left it for a while. The OS is obliged to page it out to the swap file so that when the app asks for it back it can get it again. Bottom line is that you have 25MB of free memory and you need more, so the system pages. You need more memory or to run less apps. -- Douglas Stetner stetner AT stetner DOT org This email sent to site_archiver@lists.apple.com
participants (1)
-
Douglas Stetner