Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > OS X > OS X 10.8 Mountain Lion

Reply
 
Thread Tools Search this Thread Display Modes
Old Jan 18, 2013, 12:56 PM   #1
atteligibility
macrumors regular
 
Join Date: Sep 2012
Inactive memory

- 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?
atteligibility is offline   0 Reply With Quote
Old Jan 18, 2013, 02:57 PM   #2
b0fh666
macrumors regular
 
Join Date: Oct 2012
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
b0fh666 is offline   0 Reply With Quote
Old Jan 18, 2013, 02:57 PM   #3
wrldwzrd89
macrumors G4
 
wrldwzrd89's Avatar
 
Join Date: Jun 2003
Location: Solon, OH
Quote:
Originally Posted by atteligibility View Post
- 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.
__________________
iMac Intel (Rev H, 27"), 1TB HDD, 16GB RAM, 10.8.4
wrldwzrd89 is offline   0 Reply With Quote
Old Jan 18, 2013, 03:18 PM   #4
atteligibility
Thread Starter
macrumors regular
 
Join Date: Sep 2012
Quote:
Originally Posted by b0fh666 View Post
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.
atteligibility is offline   0 Reply With Quote
Old Jan 18, 2013, 06:34 PM   #5
b0fh666
macrumors regular
 
Join Date: Oct 2012
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
b0fh666 is offline   0 Reply With Quote
Old Jan 18, 2013, 06:58 PM   #6
vladster
macrumors member
 
Join Date: Jul 2011
Quote:
Originally Posted by atteligibility View Post
- 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.
vladster is offline   0 Reply With Quote
Old Jan 20, 2013, 09:07 AM   #7
ElectricSheep
macrumors 6502
 
Join Date: Feb 2004
Location: Wilmington, DE
Send a message via AIM to ElectricSheep
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.
__________________
15'' MBP (early 2011) | i7 3770k Hackintosh | i7 Mac Mini (late 2012) | iPhone 5 | iPad 3 (2012) | iPad mini | MacOS X 10.9.2
ElectricSheep is offline   0 Reply With Quote
Old Jan 20, 2013, 09:16 AM   #8
matamoris
macrumors member
 
Join Date: Sep 2011
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.
matamoris is offline   1 Reply With Quote
Old Jan 20, 2013, 11:31 AM   #9
ElectricSheep
macrumors 6502
 
Join Date: Feb 2004
Location: Wilmington, DE
Send a message via AIM to ElectricSheep
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.
__________________
15'' MBP (early 2011) | i7 3770k Hackintosh | i7 Mac Mini (late 2012) | iPhone 5 | iPad 3 (2012) | iPad mini | MacOS X 10.9.2
ElectricSheep is offline   0 Reply With Quote
Old Jan 20, 2013, 08:35 PM   #10
atteligibility
Thread Starter
macrumors regular
 
Join Date: Sep 2012
Quote:
Originally Posted by ElectricSheep View Post
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?
atteligibility is offline   0 Reply With Quote
Old Jan 23, 2013, 11:04 AM   #11
ElectricSheep
macrumors 6502
 
Join Date: Feb 2004
Location: Wilmington, DE
Send a message via AIM to ElectricSheep
Quote:
Originally Posted by atteligibility View Post
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.
__________________
15'' MBP (early 2011) | i7 3770k Hackintosh | i7 Mac Mini (late 2012) | iPhone 5 | iPad 3 (2012) | iPad mini | MacOS X 10.9.2
ElectricSheep is offline   0 Reply With Quote
Old Feb 7, 2013, 01:24 PM   #12
arthurW
macrumors newbie
 
Join Date: Feb 2013
Location: Virginia
Purge command to release inactive memory

Quote:
Originally Posted by b0fh666 View Post
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
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.
arthurW is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > OS X > OS X 10.8 Mountain Lion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 10:45 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC