I'm just wordering what happens when I run out of free RAM, What will Happen will my Inactive RAM become free RAM? I Don't know (lol)
So when I run out of free, Inactive RAM will become free RAM or am I wrong?Inactive RAM is equivalent to free RAM.
So when I run out of free, Inactive RAM will become free RAM or am I wrong?
Inactive ram doesn't go into the free ram box, it's just remains available to any apps that need it. Inactive ram is basically ram that other programs got from free ram and remains in reserve to relaunch those apps. If no more ram is left in the "free" state new applications will use the inactive ram since it's not being used by the other programs that it was in reserve for. Hope that's clear enough.![]()
basically, if you run out of free ram, you start rewriting inactive ram until you run out of that too. When you run out of both free and inactive ram you start to pageout to the hd.
pageouts happen regardless of whether your RAM is full or not.
pageouts happen regardless of whether your RAM is full or not.
What is a page out?
thats what apple wants you to think. just because it says nothing has happened doesnt mean that nothing has actually been paged out. the fact that you have a VM size of 139GB tells me that page outs/ins are occuring, maybe not for the applications (which is probably what activity monitor only measures) but for OS etc.O rly?
![]()
I haven't paged out in forever...
A page out:
basically it happens when you're RAM is all being used, so the OS starts to write the info to your hard disk. It's a lot slower than using the RAM, but for the most part with OS X, the software is smart enough that you wouldn't really notice unless it's paging like a mo' fo'.
Activity monitor doesn't monitor OS level stuff?thats what apple wants you to think. just because it says nothing has happened doesnt mean that nothing has actually been paged out. the fact that you have a VM size of 139GB tells me that page outs/ins are occuring, maybe not for the applications (which is probably what activity monitor only measures) but for OS etc.
Activity monitor doesn't monitor OS level stuff?
well of course yes lol, memory usage from OS threads and all that duh. but i am uncertain if it monitors the lower level things.
It monitors the kernel, does it get any lower than that? Other than firmware, but that doesn't have much to do with memory management.
thinking about it: the mere fact that you have VM means that some sort of pages have to occur! otherwise you wouldnt have any VM, simple as that!!
i was not aware of that. windows handles it the conventional way? or does it also handle it in this manner?That's not quite right because everything in Mac OS X is 'virtual' memory, it just so happens that some of it is physical RAM. As a result, OS X does not treat RAM any different from the rest of the address space. For the most part, anything outside of the VM paging system doesn't even know that the RAM/Swap border exists (excluding kernel-space pages, aka: wired memory), all it knows it that it got a page it can read/write to; if it did, you're looking at the potential for some really nasty bugs. Looking at the global VM size is also fairly useless as, by default, Mac OS X sets that size to be the total amount of free space on your HD.
i knew i was right with the "always page outs" arguements, somebody told me long ago. i just never had enough in depth knowledge to say why i was correct haha. thankyouThere will always be some degree of page outs regardless of how much memory you have as OSX will attempt to keep everything it can (above a certain Free threshold) in either Active or Inactive memory. Since RAM is limited, no matter how much you have, eventually the amount of Free pages will dip below a threshold and the system will swap out some of the most unused Inactive pages.
well that is to be expected as the OS does this to make way for other applications/processes, or to "put aside" the things that are being used the least.If you have a lot of RAM this will happen less often as much of the data in memory is shared code but at some point it will happen. If the system needs it back, it triggers a hard page fault (there are also soft page faults but these are just Inactive->Active transitions) and the swap page gets paged back in as Active. What you need to watch out for is excessive page out/in activity. Once in a while is fine, won't have a noticeable effect on your performance and is necessary for the system to run.
like mineIf your HD is constantly grinding and your page out to page in ratio is really high
thanks! i have always wondered what the actual amount is. off a fresh restart i will find that i constantly get 1GB+ pageouts per day, swap memory hovers around 3GB (RAM is maxed on my poor MBP).then you have a performance killer. IIRC, the a good rule of thumb is trying to keep your long-term average ratio below 0.25 or 0.20. For example, a single day with a 1.0 ratio is not a good reason to buy more RAM while a month of 0.75 probably is.
care to describe what a 'page' is? is it a "packet" of memory? what size are these pages?The main transitions are:
Free -> Active - Free memory above threshold, create a new page
Active -> Inactive - Page out, Page hasn't been touched in a while, may not be needed but keep it in memory
Inactive -> Active - Page in, Soft fault. Something needed an old page
Inactive -> Backing - Page out to swap, free memory has dropped below threshold value, Write page to HD and mark as Free. This is what is counted in your "Page Out" statistic.
Backing -> Free - Page in, Hard fault. Something needed an old page, find a free page and read in the needed page from the swapfile
i have more page outs then insOne thing to note is that ANY page fault counts towards your page ins but only swap outs count toward your page out stat. It is entirely possible to have a system with a high number of page ins without any page outs.
yup i knew that much hahaThe "Wired" section you see denotes memory that cannot be paged out. This is all kernel space memory structures; nothing in userland can exist here.
...
Inactive -> Active - Page in, Soft fault. Something needed an old page
Inactive -> Backing - Page out to swap, free memory has dropped below threshold value, Write page to HD and mark as Free. This is what is counted in your "Page Out" statistic.
...
pageouts happen regardless of whether your RAM is full or not.
Sure does.
*takes in*Ok, here is another thing to learn
To write a file, a normal program opens the files and issues a number of "write file" calls to the OS (through whatever framework the program uses).
An alternative way is to map the file into memory (mmap). The file can then be read just by accessing the memory, as if it had been variables in the program. Similarly, you can update the file just by altering the same memory. Then there are calls to flush those changes to disk (msync). When you are done with the file you unmap it (munmap) and the pages will become inactive or free.
ahhhh now i see! i knew these things happened but i was unsure as to why. you just turned the mud into glass!If you flush the pages (msync) the OS will do page outs. This will happen even if you have oceans of free RAM, because you told the OS to do it.
..because the page out information is not correctSo if you are running a program that updates files in the manner I described, you cannot look at the "page out" counter to determine if you are "running low on RAM".
believe it or not i was actually going to suggest the size being 4KB. i had a feelingWhat's a page? It is just a contiguous block of memory. How much depends on the hardware architecture (and some architecture allows multiple page sizes). 4096 bytes is a common page size.