Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

atteligibility

macrumors regular
Original poster
Sep 14, 2012
223
2
- I have a Macbook Pro 2009, with ML 10.8.2, 8Gb of RAM. I frequently run into insufficient memories, slowdowns and beach ball. The slowdowns ALWAYS happen when FREE memory gets to 0 (typical inactive memory is 3Gb).
- I used to believe that MacOS was behaving as it should and start releasing and using the inactive memory. However, every single time my free memory gets to 0, I get the beach ball, regardless of the amount of inactive memory.
- So I have now started to believe that MacOS just wasn't usint ianctive memory as it should.
- I since got an iMac, I installed 32Gb to make sure I don't run into these issues for some time. I am having a similar activity on my iMac as I have on my MacBook Pro. When I am using it actively, I use a similar amount of memory than on my Macbook Pro, i.e. 7-8Gb.
- However I have noticed that every morning when I awake my iMac, the inactive memory is down to almost 0, while on my Macbook, it stays at high levels (2-3Gb).
- SO now, I am wondering if there is a problem with my Macbook setup, that makes the inactive memory behave differently.

My question is: How do we troubleshoot this, is there a way to see which processes are using the inactive memory?
 

b0fh666

macrumors 6502a
Oct 12, 2012
954
785
south
probably an useless response, but what the hell...

what I learned about OSX memory is that 'wired' memory is in use, and 'active' and 'inactive' are the same as 'free' from the usage standpoint...

also, I did not lie it's swapping manners (actually I never found an OS whose paging I liked, except maybe linux with a tweaked scheduler/VMM but I digress)... anyway I disabled OSX swap, put 16 gigs and never looked back.

cheers
 

wrldwzrd89

macrumors G5
Jun 6, 2003
12,110
77
Solon, OH
- I have a Macbook Pro 2009, with ML 10.8.2, 8Gb of RAM. I frequently run into insufficient memories, slowdowns and beach ball. The slowdowns ALWAYS happen when FREE memory gets to 0 (typical inactive memory is 3Gb).
- I used to believe that MacOS was behaving as it should and start releasing and using the inactive memory. However, every single time my free memory gets to 0, I get the beach ball, regardless of the amount of inactive memory.
- So I have now started to believe that MacOS just wasn't usint ianctive memory as it should.
- I since got an iMac, I installed 32Gb to make sure I don't run into these issues for some time. I am having a similar activity on my iMac as I have on my MacBook Pro. When I am using it actively, I use a similar amount of memory than on my Macbook Pro, i.e. 7-8Gb.
- However I have noticed that every morning when I awake my iMac, the inactive memory is down to almost 0, while on my Macbook, it stays at high levels (2-3Gb).
- SO now, I am wondering if there is a problem with my Macbook setup, that makes the inactive memory behave differently.

My question is: How do we troubleshoot this, is there a way to see which processes are using the inactive memory?
Inactive memory is defined in OS X as memory that WAS being used by a process in the past (and thus was Wired or Active), but now no longer is. That being the case, I think what you'd want is the memory usage history, not a current snapshot... but I do not know how you'd get either of these things.
 

atteligibility

macrumors regular
Original poster
Sep 14, 2012
223
2
probably an useless response, but what the hell...

what I learned about OSX memory is that 'wired' memory is in use, and 'active' and 'inactive' are the same as 'free' from the usage standpoint...

also, I did not lie it's swapping manners (actually I never found an OS whose paging I liked, except maybe linux with a tweaked scheduler/VMM but I digress)... anyway I disabled OSX swap, put 16 gigs and never looked back.

cheers

Yeah, that's the official understanding, yet this would not explain why the system starts beachballing as soon as free gets to 0, with 3Gb of inactive left. Clearly, on my system at least, inactive doesn't behave as free.
 

b0fh666

macrumors 6502a
Oct 12, 2012
954
785
south
when I do 'purge' both active and inactive become 'free', that's why I guess they were not being 'used' for real, maybe caching disk sectors or something :D
 

vladster

macrumors member
Jul 25, 2011
82
1
- I have a Macbook Pro 2009, with ML 10.8.2, 8Gb of RAM. I frequently run into insufficient memories, slowdowns and beach ball. The slowdowns ALWAYS happen when FREE memory gets to 0 (typical inactive memory is 3Gb).
- I used to believe that MacOS was behaving as it should and start releasing and using the inactive memory. However, every single time my free memory gets to 0, I get the beach ball, regardless of the amount of inactive memory.
- So I have now started to believe that MacOS just wasn't usint ianctive memory as it should.
- I since got an iMac, I installed 32Gb to make sure I don't run into these issues for some time. I am having a similar activity on my iMac as I have on my MacBook Pro. When I am using it actively, I use a similar amount of memory than on my Macbook Pro, i.e. 7-8Gb.
- However I have noticed that every morning when I awake my iMac, the inactive memory is down to almost 0, while on my Macbook, it stays at high levels (2-3Gb).
- SO now, I am wondering if there is a problem with my Macbook setup, that makes the inactive memory behave differently.

My question is: How do we troubleshoot this, is there a way to see which processes are using the inactive memory?

There's purge command that releases inactive memory that is possible to execute from terminal. When that command executed, from my experience, OS is slowing down to the point of a temporary short freeze.

So I guess every time MAC OS X tries to release some inactive memory that freezes the system as this presumably blocks running applications from allocating memory or even accessing it.

I guess they should make this process less intrusive or get rid of "inactive" memory completely and just release it immediately. Seriously there's more complaint about, and I don't remember any appreciation.
 

ElectricSheep

macrumors 6502
Feb 18, 2004
498
4
Wilmington, DE
The purge command can only release inactive pages which have been memory mapped to a file; anonymous memory such as buffers allocated in an application's heap area and other regions of memory are not touched.

There seems to be an impression that inactive memory is the same as unused memory, but this is not the case. Inactive memory hasn't been accessed in a while and is a good candidate for paging/releasing. However, inactive memory can still contain valid allocated objects. If the operating system were to release them, the next time an application tries to access them it will crash; they must be paged out to disk before they can be released.

When free memory reaches a low water mark very close to zero, this triggers to kernel to traverse the inactive page list looking for candidate pages to page out and release. Memory-mapped pages can be 'stolen' to the free-page list only if that have not been modified in any way since the last time they were written back to disk. Otherwise, they must be saved to swap. The process of saving to swap is where you are going to encounter slowness and beach-balls as disk operations are many many times slower and must be completed before anything other allocations can continue.
 

randolorian

macrumors 6502a
Sep 3, 2011
565
1,753
It seems to me that Mac OS X should be more aggressive about dropping buffers/cache when the system is low on memory. Both Windows and Linux seem to handle this better.
 

ElectricSheep

macrumors 6502
Feb 18, 2004
498
4
Wilmington, DE
sysctl provides a few variables that relate to how aggressive the pageout daemon is:

kern.vm_page_free_target
kern.vm_page_free_min

The variables are for number of pages, which you can convert to a memory about by multiplying by a pagesize of 4096 bytes. page_free_min is the trigger level: if the number of free pages go below that level the pageout daemon is called. It will attempt to migrate enough pages from the inactive list to the free list via stealing or pageout until the count reaches the page_free_target.
 

atteligibility

macrumors regular
Original poster
Sep 14, 2012
223
2
The purge command can only release inactive pages which have been memory mapped to a file; anonymous memory such as buffers allocated in an application's heap area and other regions of memory are not touched.

There seems to be an impression that inactive memory is the same as unused memory, but this is not the case. Inactive memory hasn't been accessed in a while and is a good candidate for paging/releasing. However, inactive memory can still contain valid allocated objects. If the operating system were to release them, the next time an application tries to access them it will crash; they must be paged out to disk before they can be released.

When free memory reaches a low water mark very close to zero, this triggers to kernel to traverse the inactive page list looking for candidate pages to page out and release. Memory-mapped pages can be 'stolen' to the free-page list only if that have not been modified in any way since the last time they were written back to disk. Otherwise, they must be saved to swap. The process of saving to swap is where you are going to encounter slowness and beach-balls as disk operations are many many times slower and must be completed before anything other allocations can continue.

ok, I see. So this would explain why my purge doesn't get my inactive memory lower than 2Gb in some cases.
Since I don't see the same crazy consumption of inactive memory on my macbook and iMac, I would like to figure out what would be the difference between the two.
Any idea on how I would get about troubleshooting this? any way to list what applications the objects in inactive memory belong to?
 

ElectricSheep

macrumors 6502
Feb 18, 2004
498
4
Wilmington, DE
ok, I see. So this would explain why my purge doesn't get my inactive memory lower than 2Gb in some cases.
Since I don't see the same crazy consumption of inactive memory on my macbook and iMac, I would like to figure out what would be the difference between the two.
Any idea on how I would get about troubleshooting this? any way to list what applications the objects in inactive memory belong to?

Sadly, that would require either a custom kernel build or a kernel extension. The APIs exposed by the kernel only provide information about Active/Inactive/Wired memory at a host level, not at a task level.

You can use vmmap in the Terminal to view how memory was allocated in a particular task, but I am not aware of any way to associate those mappings to a specific page list in the kernel.
 

arthurW

macrumors newbie
Feb 7, 2013
5
0
Virginia
Purge command to release inactive memory

when I do 'purge' both active and inactive become 'free', that's why I guess they were not being 'used' for real, maybe caching disk sectors or something :D

I use Autocad for Apple and it not so slowly moves memory to being inactive. And I have read a lot of posts on the web arguing that inactive memory moves seamlessly to active when needed, but I have NEVER found this to be true on my Mac. As the inactive memory grows, and the free memory shrinks, the Mac gets increasingly sluggish until eventually the "wheel" shows its face for a few seconds now and then, and then ultimately the computer crashes. My solution in the past has been to reboot. I finally tired of doing so, and gratefully read this previous post. It works GREAT! Just go to console and type "purge" ... and wait a minute - bingo, tons of free memory back. THANKS.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.