4

First of all i'd like to ask politely for all of those who feel the need to explain it to me how perfect apple's memory management is to ignore this thread.

A little background:

The theory goes that if you have lots of inactive memory - it's can be freed for applications that need it. It's like free memory according to apple and their blind followers. And i like the idea of it, but... in practice: when free memory hits low numbers and inactive hits high numbers - osx (at least snow leopard) slows down ... So even if the inactive memory is being freed - it is done very very slow and that's not acceptable.

But for some reason the problem has just gotten worse for me: i've just noticed that inactive memory keeps piling up faster than ever. I've done a couple of purges just to confirm my theory and ... the number gets high again very fast ...

So until apple fixes whatever is wrong with their memory management - i'd at least like to know which apps are producing the inactive memory.

Is there a way to somehow monitor processes and see how much memory they allocate and free during their lifetime?

Thanks for your thoughts

Marius
  • 143
  • 3
  • This isn't quite clear--do you mean something more specialized than Activity Monitor? – Zo219 Jan 17 '13 at 07:13
  • Yes. Maybe a shell command or smth like that. Or some other in-depth process monitor able to track memory allocations. – Marius Jan 17 '13 at 13:18
  • Marius, me too. I installed 'Free Memory' to clear that inactive memory for me automatically, it needs to do it several times a day. Right now I have 900MB free and 3GB inactive. Its a super irritating problem and I would love to know what I can do to fix it. – Christian Feb 01 '13 at 23:57
  • 1
    @Christian: if you have enough ram you can disable virtual memory alltogether. Mac's memory management is amazing in theory, but in practice i've never seen anything more terrible. There's also some sort of replacement for mac's default pager to overrade swapping settings. So, there's two things you could try if you're brave enough :) – Marius Feb 05 '13 at 14:36
  • Thanks @Marius - have you read this? http://superuser.com/questions/317215/how-to-disable-mac-os-x-from-using-swap-when-there-still-is-inactive-memory – Christian Feb 06 '13 at 04:49
  • @Christian yes, seen it ;] Basically the same thing that i said, only in lots of details ;] That's a good post. – Marius Feb 09 '13 at 19:33
  • Doesn't top provide the information you're looking for? Note that all columns aren't shown if your terminal window is too narrow. – Etheryte Feb 22 '13 at 16:51
  • Look up the "purge" terminal command, it might be able to help – Alexander Mar 16 '13 at 03:18
  • @XAleXOwnZX it is only a temporary solution unfortunately. In my case ram runs out pretty fast after purging. Until some good hacker fixes apple's good-in-theory memory management, i'm affraid we're gonna be left to suffer. – Marius Mar 20 '13 at 12:53
  • I know it's not really a solution (hence why I posted it as a comment), but it can alleviate the problem temporarily in order to (at least) regain system responsiveness. I also suggest you look into disabling Dynamic Memory Paging by running sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist (this can be undone with sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist. It may sound counter intuitive, but swapping causes the biggest issue, and Mac OS becomes more conservative on RAM usage when it can't page files out. – Alexander Mar 21 '13 at 05:34
  • @XAleXOwnZX how i wish i could do that... Unfortunately with my old mac there's only 6gb of ram and it would not be enough. And if i understand correctly, my mac would just start crashing after running out of ram. I'd definately use this if i could have myself 16 gigs or something along the lines :) Thanks for the suggestion. – Marius Mar 21 '13 at 14:12
  • "only 6gb of ram and it would not be enough" I run my macbook in this mode with only 4 lol. It doesn't crash, even when the RAM eventually fills. I suggest you check it out – Alexander Mar 21 '13 at 21:29
  • :) we'll i have lots of development tools, browsers and photoshop running almost all the time. I guess i'll have to try this, since you say it doesn't crash for you - maybe won't crash for me either :) – Marius Mar 22 '13 at 09:33

1 Answers1

1

I have had some success using the terminal command top. Much the same results as Activity Monitor, but I can slow down the update speed, and sort on any field.

In my experience, the problem is usually with individual programs that fail to free memory. You will see the memory for that process creep up. See 'man top' for details about the various fields that top reports. Firefox is notorious for this, and with 60 or so tabs requires a restart every few days

If you want to dig deeper, vmmap can give you the status of pages owned by a particular process.

Be warned: sometimes slowdowns are CPU related. Sometimes disk i/o related, althoth the latter is less common with current memory prices.

Sherwood Botsford
  • 1,892
  • 2
  • 17
  • 34
  • Thanks for your answer. Found out it was something as simple as VLC... If that can make my ram go crazy ... imagine what all the development environments and photoshops does ... – Marius Mar 20 '13 at 12:51
  • It's likely a glitch, so Xcode and final cut run just fun on most machines :P – Alexander Mar 21 '13 at 21:28