Re: swap files question.
Re: swap files question.
- Subject: Re: swap files question.
- From: Mike Laster <email@hidden>
- Date: Wed, 8 Sep 2004 20:25:23 -0400
On Sep 4, 2004, at 7:08 AM, Mike Fischer wrote:
> Hi Dieder,
>
>
> Am 04.09.2004 um 03:06 schrieb Dieder Bylsma <email@hidden>:
>
>> Is there anyway to determine which program/process is paged out to a
>> particular swap file?
>
> Err, I'm not a Darwin expert but AFAIK it doesn't really work that
> way. The vm system pages out single memory pages (4096 byte blocks of
> memory) not processes as a whole. So pages from a single process could
> be paged out to multiple physical swap files. And most likely a
> process will never be completly paged out. Only the least recently
> used memory goes to disk when RAM is needed.
>
> Also some of the address space of a process may be memory mapped to
> other files. These parts are usually (but not always) read only and
> will not be written out to disk. They are simply discarded and
> reloaded later when needed.
>
> And another point to note is that the location of a paged out memory
> page may change over time. Consider for example the case where 4 swap
> files of 64MB each are in use. Something happens on the system so that
> lots of memory gets freed and thus more than 128MB of swap space are
> left available. dynamic_pager will unregister a swap file in such a
> case and cause the vm system to empty the file of any in use swap
> space. Due to the fact that the remaining paged out memory is
> scattered across all 4 swap files the vm system needs to move pages
> around in order to empty one swap file so it can be deleted. (This is
> probably a bit oversimplified. I am guessing that when "relocating"
> paged out memory the system will probably reload them into RAM and
> then decide in a separate step that some memory needs to go back out
> to the swap files. This may or may not be the same pages just loaded
> from the soon to be obsolete swap file.)
>
> This example assumes a non-standard setting for the dynamic pager in
> Mac OS X 10.3:
> dynamic_pager -H 33554432 -L 134217728 -S 67108864 -F
> ${swapDir}/swapfile
> similar to the settings in 10.2. The standard 10.3 configuration
> creates swap files with increasing size instead of fixed size as in
> this example but for demonstration purposes this is easier to handle.
>
> Finally note that the paged out memory will probably be completly out
> of order in the swap files. You'd have a hard time piecing it back
> together even if you knew where it was located.
>
> So why do you need to know where paged out memory pages are located?
>
> If it's security you're after then it would be a better idea to
> prevent critical data to be paged out and erase its (RAM) memory right
> after use.
I've wanted similar information in the past. In my case, I was
debugging what appeared to be a weird memory leak. The number of
swapfiles in /var/vm would grow to the hundreds, and eventually the
system would run out of drive space and crash. Even after killing off
all of our server processes we had a large number of files. It would
have been handy to figure out which processes had active blocks in the
swapfiles to know which process was the culprit. The problem seemed to
have mysteriously went away when we disabled some unused system
services in /etc/hostconfig.
It would have been useful if there were some sort of "reverse" vmmap
tool that would walk a swapfile and report the owner of each page
contained in it.
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
darwin-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-development
Do not post admin requests to the list. They will be ignored.