PDA

View Full Version : Improved memory management




brijazz
Jul 28, 2012, 05:45 AM
Under Lion (and to some extent, Snow Leopard), I used to get significant pageouts despite having 8GB of RAM on my mid-2010 MacBook Pro. Since installing Mountain Lion... no pageouts after nearly 48 hours of uptime. Very promising. Thanks, Apple!

If you're interested, my memory issues were discussed here: http://forums.macrumors.com/showthread.php?p=14771029#post14771029



steve-p
Jul 28, 2012, 06:20 AM
I have zero page outs too, even after running Aperture and a couple of VMs in Parallels for a while, which is a first. Swap used was always zero but with quite a few page outs. Something changed, and I hope it's not just that they broke page out reporting :)

rodknocker
Jul 28, 2012, 06:38 AM
What about my stats?


Mach Virtual Memory Statistics: (page size of 4096 bytes)
Pages free: 618579.
Pages active: 956450.
Pages inactive: 77048.
Pages speculative: 83342.
Pages wired down: 359306.
"Translation faults": 356838538.
Pages copy-on-write: 18984077.
Pages zero filled: 169357675.
Pages reactivated: 426478.
Pageins: 6605659.
Pageouts: 1750141.
Object cache: 26 hits of 2605335 lookups (0% hit rate)

steve-p
Jul 28, 2012, 06:45 AM
What about my stats?


Mach Virtual Memory Statistics: (page size of 4096 bytes)
Pages free: 618579.
Pages active: 956450.
Pages inactive: 77048.
Pages speculative: 83342.
Pages wired down: 359306.
"Translation faults": 356838538.
Pages copy-on-write: 18984077.
Pages zero filled: 169357675.
Pages reactivated: 426478.
Pageins: 6605659.
Pageouts: 1750141.
Object cache: 26 hits of 2605335 lookups (0% hit rate)

Well I have

Mach Virtual Memory Statistics: (page size of 4096 bytes)
Pages free: 563475.
Pages active: 557086.
Pages inactive: 497721.
Pages speculative: 75622.
Pages wired down: 400920.
"Translation faults": 11904291.
Pages copy-on-write: 326331.
Pages zero filled: 10498030.
Pages reactivated: 2166.
Pageins: 166227.
Pageouts: 0.
Object cache: 12 hits of 63484 lookups (0% hit rate)

Which shows zero page outs also.

rodknocker
Jul 28, 2012, 06:46 AM
Your uptime?

I do nothing special. Just surfing, emailing and so on...

Therefore this seems to be HUGE pageouts.

steve-p
Jul 28, 2012, 06:57 AM
Only 12 hours but during that time I've been running multiple VMs, Aperture, iTunes, Safari, Mail, Notes, Preview, Time Machine concurrently. Previously there would have been page outs recorded but no swap used.

rodknocker
Jul 28, 2012, 07:01 AM
What about my stats?

steve-p
Jul 28, 2012, 07:27 AM
What about my stats?
Not good, but how much RAM do you have and how long since a reboot?

cptodd
Jul 28, 2012, 07:30 AM
Same here. I have been able to switch back to Safari.

rodknocker
Jul 28, 2012, 07:50 AM
8 GB RAM

7 days Uptime.

Ulf1103
Jul 28, 2012, 08:42 AM
probably a stupid question, bu were do you guys find Object cache

this is what i see:

rodknocker
Jul 28, 2012, 08:46 AM
vm_stat :)

----------

I don't understand why i so terrible stats :-(

Does someone know? Maybe Google Chrome?

steve-p
Jul 28, 2012, 09:14 AM
8 GB RAM

7 days Uptime.

You are on Mountain Lion though right?

rodknocker
Jul 28, 2012, 09:37 AM
You are on Mountain Lion though right?

Of course.

rodknocker
Jul 28, 2012, 11:38 AM
I think it was because of VMware Fusion. I used it in the last 7 days.

Now after reboot page out is zero :) I will keep an eye on it to see when page out will grow :)

throAU
Jul 28, 2012, 11:49 AM
Some page outs if you've run vmware are nothing to worry about.

It's the number in brackets you want to worry about.

If your machine is running slow, AND the number in brackets (page outs/sec) is not zero, then you need more ram at that point.

Having some paging, when you have applications in the background doing nothing is to be expected unless you are way over spec on RAM. Inactive applications are better paged out to make more room for buffer cache (i.e., if they are paged out, they are still in "inactive memory" and can be reclaimed instantly if more ram is needed).


Seriously, people need to relax, stop looking at inactive memory and total page out numbers and let the VM subsystem do its job.

Worry about the pages/sec while you are working, not the total numbers. Having stuff paged out that is doing nothing while the system is idle is nothing to worry about really.

I mean, for example: i have a 34 gig iphoto library.

After browsing my photos, i have 4.5gig in inactive memory, after quitting iphoto. I also have page outs (i have 8 gig ram)

This inactive memory can be reclaimed as needed. But if i fire up iphoto again, or access the iphoto database from another app, it is already in RAM for future reference...

Dumping all that cache, or having iphoto consume less memory so some idle application (i.e., one that is doing nothing) doesn't need to get paged out would be a net lose.

Fusion will do the exact same thing to try and cache access to your VM's VMDK file, to speed up virtual disk access.

"Free" memory is useless.

rodknocker
Jul 28, 2012, 11:56 AM
Thank you for the detailed description :)

It was only a bit surprised, because my system is very fast ;-)

throAU
Jul 28, 2012, 12:00 PM
Thank you for the detailed description :)

It was only a bit surprised, because my system is very fast ;-)

A system that swaps intelligently SHOULD be fast, as it can better use the RAM for cache (inactive memory). Memory that is either free or consumed by an inactive app is wasted. The inactive app is better swapped out - "depending" on various circumstances, like how often it activates, etc. The kernel can only guess at these things - based on prior application performance.

Lion was slightly brain damaged as it appeared to try and swap too aggressively and hold onto inactive memory in preference too much (speculation: possibly because apple tested it more on SSD and neglected tuning for hard disk paging performance). i.e., the "guessing" Lion did about when to swap was poorly tuned when taking spinning disk performance into account...

ML seems much better as far as performance goes, but the basic idea is the same. I'd wager they just slightly tweaked some numbers in the kernel that determine how aggressively it will swap things out, vs keeping them in memory so that it doesn't hammer the disk.

adnbek
Jul 28, 2012, 12:17 PM
I'm finding Safari MUCH better now with ML. It's used to hog tons of ram after it's been running for a while and I've done lots of surfing, but with ML no such thing.

It could be Safari 6 more than ML that's made the difference, I don't know. But I've had Safari open since the upgrade (and have browsed a lot since then) and Safari + Safari Web Content only taking about 400-500mb of RAM. At this point with Safari 5 and Lion it would have easily been in the GBs by now.