You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

kernel_task consumes a lot of RAM in early 2011 MBP, sometimes Finder too

Hi,

My old MBP3,1 (late 2007, 2.4 GHz Core 2 Duo) worked quite well with 4 GB of RAM, even after weeks without restarting. In fact, I used all available RAM only on some larger analyses using R, which loads the entire dataset in memory. To be able to run these few analyses faster on my new machine (early 2011 MBP), I bought the 8 GB RAM option.

In Activity Monitor, I noticed something strange. Whereas my old MBP shows kernel_taks as using between 100 and 200 MB of RAM, the new MBP uses about 550 MB just after the machine started up and often shows over 600 after a few hours or days of use. A one year old iMac, again Core 2 Duo with 4 GB of RAM, gives a kernel_task memory usage below 200 MB after weeks of use.

I've not been able to find what kernel_task does. Is this amount (around 600 MB, but it has gone up to 800) normal? Is it managiing the additional number of cores that requires this behind the scenes amount of RAM?

Anyway, I now quite often have more than 4 GB of RAM in use even when I have only a few applications running (not even including R!), which surprises me.

Also today, after moving a lot of files back and forth between an external drive and the new MBP, after emptying the garbage can that contained a hefty number of files and doing a first Time Machine backup, the Finder ended up using 2,4 GB of RAM according to Activity Monitor. I have never seen anything like this (although I admit not having Activity Monitor on all the time). Even after the backup was finished and the external drive disconnected (in fact the machine was left idling for a few hours) cpu usage was down to nearly zero, the Finder kept its 2.4 GB of RAM. I restarted and the new RAM usage for the Finder was 26 MB. I have a screen shot showing the 2.4 GB, but I could not find a way to attach it to this message. I can send it by email on request. I don't think this Finder behavior was normal.

Somewhat worried,

Denis

MacBook Pro 2.2 GHz i7, 8 GB RAM, Mac OS X (10.6.6)

Posted on Mar 16, 2011 12:04 AM

Reply
216 replies

Feb 8, 2012 2:01 PM in response to eww

Eww. thanks for the article. Doesn't bring me clarity I'm afraid.

Thanks wyager - I'll look into it. (Apple do seem to prefer the blame Adobe line so I'll have a go at your suggestions. I have, however, uninstalled and reinstalled cs5 from their site so would expect it to run just fine.)


Actually, the big surprise is that the guy on the genius bar in Manchester told me he wasn't familiar with Photoshop and that he was sure my Apple was fine and that Adobe must be at fault. (Not once did he touch the Mac. Not once!)


Perhaps he's right... Apple is always perfect and that wierd photoshop thingy was causing the problems. I tried to tell him that Photoshop is sometimes used by MBP owners even if he didn't use it, but he was having none of it - Bing, my ten minutes was up.


Fantastic looking shop though!

Feb 8, 2012 5:32 PM in response to dave1click

Hi, there is a couple of things that struck me about your posts so I'll list them here and hopefully they prove helpful to you.


Firstly, being new to Mac I'm wondering if you are making the mistake that I've seen some others make when switching to Mac. When closing a OS X application, the Red "X" button on the top left of the window - unlike Linux and Windows, does not close the application, It just closes the current window, leaving the application still running. To actually close the application and reclaim the memory for other applications to use, you need to Quit the application from the File menu. Command-Q


Secondly, with regard to the size of the kernel task. From reading this thread and my own experiences I can tell you that the size of the kernel task is in direct relation to the amount of memory your machine has. The more memory, the larger the task. I don't know the internals of it, but the most likely scenario is that Apple seems to have a general design philosphy of making use of available memory for caching data. This usually contributes towards making your machine faster. It doesn't mean you have less memory because the cache memory can be wiped if processes need the memory.


Thirdly is the memory which is tagged as inactive, this is memory that previously held a loaded application or data. Rather than clearing this memory when you quit an application, OS X will tag it as available, but still keep the application and data loaded. Then if you decide to restart the application, it can restart directly from memory rather than the hard drive. Obviously a big speed boost. If other applications need the memory, then OS X will use this memory as if it was free memory so when counting available memory, combine both free and inactive together.


Finally, the best way I have found to tell if your machine is poorly performing - apart from obvious UI slow downs, is too watch your disk activity. If you see a lot of disk activity when you are not reading or writing files, or when switching between applications, it is an indicator that your applications are trying to allocate more memory than you have and swapping out to disk. An extremely slow process. Then you need more.


Over the years I've run everything including DOS, OS/2, various Windows, various Linuxs and now Mac OS X. Of all of them my experience says that the OS X runs the smoothest, has the UI with by far the least annoyances and the slickest software. Notice that I did not say it has the least memory usage because ultimately I don't care whether I have 5M or 5G free, what I care about is how smoothly the system is running.


And one last thing - if you are maxing out on memory. Check with third party stores such as macfixit.com.au because they offer memory upgrades larger than Apple do. I bought one of their to take my MPB from 4G to 16G and its screamingly fast now.


Hope this helped.


ciao

Derek

Feb 8, 2012 6:11 PM in response to drekka

Hi Derek,

Thanks for the helpful post. A few things though. I don't think the kernel's RAM allocation is for holding cached data. As you said, that's what "inactive" memory is for. As of yet, I don't think we have a good explanation for why k_t takes up more RAM as you add more.


Also, as for

If other applications need the memory, then OS X will use this memory as if it was free memory so when counting available memory, combine both free and inactive together.


In my experience, the OS is very reluctant to free up "inactive" memory and will often simply use virtual RAM, which is of course not good. The OS is also not very clever about what it keeps and dumps. For example, when I am watching streaming video (Hulu), sometimes the video will stutter. Usually, I have a ton of inactive memory that the kernel refuses to free up and only a "purge" will fix it.

Feb 8, 2012 6:13 PM in response to drekka

I'll share a bit of my 7 years experience with Macs.

drekka wrote:


Firstly, being new to Mac I'm wondering if you are making the mistake that I've seen some others make when switching to Mac. When closing a OS X application, the Red "X" button on the top left of the window - unlike Linux and Windows, does not close the application, It just closes the current window, leaving the application still running. To actually close the application and reclaim the memory for other applications to use, you need to Quit the application from the File menu. Command-Q


In if you close the window you should get back the memory instantiated by that window's objects. The rest of the application should, if correctly programmed, just use a fair amount of ignorable RAM (if you find useful not having to close an app you need every now and then.


Secondly, with regard to the size of the kernel task. From reading this thread and my own experiences I can tell you that the size of the kernel task is in direct relation to the amount of memory your machine has. The more memory, the larger the task. I don't know the internals of it, but the most likely scenario is that Apple seems to have a general design philosphy of making use of available memory for caching data. This usually contributes towards making your machine faster. It doesn't mean you have less memory because the cache memory can be wiped if processes need the memory.


I see, but it makes little sense to me that I should lose 800-1.25 GB of RAM. By this principle if I had 128 GB of RAM kernel_task should take 10-15 GB of ram for "nothing" just after booting... I cannot agree. If it needs something its memory consumption should be more static and not size-of-your-ram-dependent. I fear it does not have much to do with caching, since there is a separate place for that.



Thirdly is the memory which is tagged as inactive, this is memory that previously held a loaded application or data. Rather than clearing this memory when you quit an application, OS X will tag it as available, but still keep the application and data loaded. Then if you decide to restart the application, it can restart directly from memory rather than the hard drive. Obviously a big speed boost. If other applications need the memory, then OS X will use this memory as if it was free memory so when counting available memory, combine both free and inactive together.




Inactive memory of course should not be counted as wasted RAM, as it can be reclaimed when needed. What maybe you do not know is that RAM used for caching will limit the real free RAM... what I think is a bug will cause - under high memory usage with low to medium-high amounts of RAM installed (4-8 GB nowadays) - the system to start swapping on disk before reclaiming memory from the cache. This is the issue I suffered the most in years of using OS X. My last machine, a 2008 MBP 15", supported 6 GB of RAM (4 according to Apple, but they were wrong) and I could barely fit in it (I am a power desktop user, but not a video-editing/photo-editing pro). With 4 GB of RAM I would usually swap under a few hours, and once you have e few MBs of swap with that amount of installed RAM, the situation will get worse, even if you have 1-2 GB of inactive RAM. My co-worker has 8 GB of ram and after a few days (he needs to power down the machine the least possible) Activity Monitor will report 4-5 GB of swap used. An OS that swaps so much and uses so much memory for everything cannot be considered a good "memory manager" IMHO. If it were better, caches would be automatically purged and swap would be minimal (as linux seems to do, but I use it too little to be totally sure). I think there is some truth in what I say because I learned that calling "purge" from the command line before starting to en my free memory would keep my swapping to a minimum and my machine snappy. Without doing so it would lag badly,very badly.




Finally, the best way I have found to tell if your machine is poorly performing - apart from obvious UI slow downs, is too watch your disk activity. If you see a lot of disk activity when you are not reading or writing files, or when switching between applications, it is an indicator that your applications are trying to allocate more memory than you have and swapping out to disk. An extremely slow process. Then you need more.


Welcome to swapping 😀 ActivityMonitor.app -> System Memory -> Swap Used


Over the years I've run everything including DOS, OS/2, various Windows, various Linuxs and now Mac OS X. Of all of them my experience says that the OS X runs the smoothest, has the UI with by far the least annoyances and the slickest software. Notice that I did not say it has the least memory usage because ultimately I don't care whether I have 5M or 5G free, what I care about is how smoothly the system is running.


And one last thing - if you are maxing out on memory. Check with third party stores such as macfixit.com.au because they offer memory upgrades larger than Apple do. I bought one of their to take my MPB from 4G to 16G and its screamingly fast now.


I use OS X because I find it more stable, I love the UI, love some of its features and a lot of unique apps. Memory management is the thing that I must live with that mostly annoys me. When I bough my PowerBook G4 (1.33 GHz, 256!!!!! MB of RAM), it was a beauty, but after opening two apps it would lag like ****, in a very stylish way (ahah). Later I settled for 768 MB (RAM was crazy expensive at that time) and it was usable, but my multitasking ability was very limited. When I maxed it out at 2 GB it was almost OK, but not that much even for the year 2007 and what it had to offer. In late 2008 my MBP with 4 GB of RAM was balanced, but running a 768 + 256 MB VM was the main task that would push me into swapping land. At 6 GB it was a lot better, but on the long run I suffered the same issues. At that time (2010) I also run a 4 GB desktop and there was no way that I could use it for work, even without VMs (a single tab in most browsers can eat enormous shares of precious memory). My recent (replaced by Apple, thanks) MBP supports 16 GB of RAM and is simply my SAVIOR. It's such an impressive amount of memory that with very little care about RAM usage I can get to the end of the day without swapping more than a few MBs even if I usually load about 5-8 GB of active/wired memory. I'm really sure that lots of users use far more memory than me, and if I need a 16 GB machine to live, I cannot imagine what they should have 😀..


What never ceases to amaze me is that Apple puts this operating system in factory limited 2 and 4 GB of RAM MacBook Airs, which should be used as iPads in semi-monotasking. iPhones and iPads with 0.5 GB of RAM seem like a miracle to me, because if they shared more with x86-osx way of working, they'd need at least twice that amount with the same multitasking limitations of iOS 1 (no multitasking at all, suspend/kill every user background process).

Feb 8, 2012 6:16 PM in response to wyager

In my experience, the OS is very reluctant to free up "inactive" memory and will often simply use virtual RAM, which is of course not good. The OS is also not very clever about what it keeps and dumps. For example, when I am watching streaming video (Hulu), sometimes the video will stutter. Usually, I have a ton of inactive memory that the kernel refuses to free up and only a "purge" will fix it.


I totally quote you. Macs become more and more machines that (should) simply work. They are more targeted to users fed up with Windows than to Pros (like years ago). It's unacceptable that these users (at least the smarter ones, haha) must learn the art of purging their caches to retain a usable machine 😠

Feb 8, 2012 7:27 PM in response to poochie2

Agreed, poochie.


Also, you mentioned that when you close a window, you should get back all the memory from objects that were created when the window was opened/used/whatever. While this is technically correct, a strange quirk of objective-c prevents this from always being the case. I don't know if garbage collection in Objective-c 2.0 fixed it, but basically it happened when A created B which created C which referenced B. Now, B and C are referencing each other, and never get deallocated. Something like that could be what is happening with photoshop. I'm pretty sure that same thing happens with Safari. (Either that, or Safari is caching webpages in RAM way too aggressively)

Feb 9, 2012 2:59 AM in response to drekka

Thanks for the reply Drekka, really helpful.


Been using Macs for 6 months though, so do know how to close Apps. I view open apps from the cool disco light in the dock.


The inactive memory available gave me hope for a while, but after close observation, I have to agree with wyager that my Mac seems very reluctant to free it up when available RAM becomes critically low.


Also sadly, I bought my MBP last year just before the new machne was launched and have maxed out my RAM at 8G


Just gotta add that I discovered this thread to try and find out why my £1700 machine is only marginally faster than my 4 year old quad core 4G PC.


I love the look.

I love the stability (but I'm told Windows 7 was pretty good as well. I have that on my mac but rarely use it)

Some programmes are quirky but most are more intuitive


What I haet is that I wanted a computer that could deal with my 5000 raw files a day which I have to process quickly in Lightroom and Photoshop.


I want to be able to open 10 files, action them and close them down faster than I can brew a cup of tea.


I don't want to see the spinning wheel every twenty minutes and it frankly isn't good enough if I have to 'purge' my memory or do some housekeeping every week.


Heck, I made enough tea with my antique 4G PC and only defragged once a blue moon.


Not being an expert, the only thing I know for sure is this.... My spinning wheel, my sloooooooooowing of my Apple, is directly related to my available RAM and I frequently find myself down to a bare few MBs.


Guys, this cannot be normal. i7,8G and doing nothing at all unusual, we're down to a few MBs.


Software issue or hardware issue - No one seems to have an answer and we all seem content to live with it.


Next week I hope to run two MBPs side by side and see if I can report back with any useful info.

Mar 2, 2012 3:02 PM in response to DChabot

I may have something to add...or maybe not, let's see.


Open up terminal and try this,


launchctl list | grep dynamic


If you get no output, it means that swapping is not running at all.

You have to turn it on.


sudo /sbin/dynamic_pager -F /private/var/vm/swapfile &


Long-winded explanation:

I have a 2010 MBP i5, 4GB RAM


I don't do anything heavy like image or video editing, just your basic

Safari, Mail, Emacs, iTunes, Vienna RSS Reader, nothing else fancy.

(Well, except that I use Path Finder and keep Finder turned off. But

that's nothing extraordinary.)


But I have been experiencing the problems described in this thread.

Over time, performance drops like a rock. Activity Monitor shows

Wired memory is about 80-90% of all 4 GBs!

Free is down to 10 Megs or so.


Yet there doesn't appear to be anything terribly leaky.

A typical distribution is

Safari Web Content 400MB

Safari 280MB

iTunes 210MB

Path Finder 150MB

Thunderbird 150MB

Emacs 100MB

WindowServer 100MB


Everything else is below 50MB. And the sum of all processes'

Real memory is always far less than 4GB.


Doesn't matter. Soon enough, if I didn't quit a few apps,

the spinning beach ball attacks me, and then the whole thing freezes.


Then I noticed this strange thing in Activity Monitor.

Swap used: 0


Zero? Yes, zero!


Opened up terminal and saw this.

ls -l /private/var/vm

total 7340032

-rw------T 1 root wheel 4294967296 Mar 2 10:28 sleepimage

-rw------- 1 root wheel 67108864 Jun 19 2011 swapfile0

-rw------- 1 root wheel 67108864 Jun 19 2011 swapfile1

-rw------- 1 root wheel 134217728 Jun 19 2011 swapfile2

-rw------- 1 root wheel 268435456 Jun 19 2011 swapfile3

-rw------- 1 root wheel 536870912 Jun 19 2011 swapfile4

-rw------- 1 root wheel 1073741824 Jun 19 2011 swapfile5

-rw------- 1 root wheel 1073741824 Jun 19 2011 swapfile6



The last time my swap files were used was June of last year!

They're not getting used at all! My Mac was running out of memory

and had no recourse!


I have now learned that swapping is controlled by

/System/Library/LaunchDaemons/com.apple.dynamic_pager.plist


However,

launchctl list | grep dynamic


shows nothing. Swapping is just not evern turned on. I then tried to turn it on.


sudo launchctl load /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist

Password:

nothing found to load



I'm sure this is what happens at boot time. I examined that file. I can't say

whether there's anything wrong with it. So I figured, what the hey, I'll run

its command. It is simply,


sudo /sbin/dynamic_pager -F /private/var/vm/swapfile &



No error message or any other output. However, lo and behold!, Wired is down to

to 650M, Active is up to 2.2G, and best of all 'Swap used' steadily increased and

is now 1.2G. My precious MBP is now operating the way it should!


Definitely, there's still the problem of why this doesn't launch successfully

at boot time. But at least I know how to plug the leak in the gas tank. I hope

someone, anyone, finds this helpful. Thanks for your time.

Mar 26, 2012 5:49 PM in response to DChabot

I'm going to add something interesting about inactive ram.

Whenever I Archive/unarchive something, the amount of ram used is closely the same amount as the file size.

I've tried different archive programs, and all of them have the same affect. Over time of no activity, the inactive ram will slowly go back to free ram. (about 5-25mb/sec). However, the ram used does not imediately go into the inactive ram, it will stay in the "active" ram, and use more free ram if I archive another file. Only when I have somewhere less than 1G of free ram left will it start to use the "active" or inactive ram. Occasionally, the OS will freeze and restart (if I don't purge continually in time). I have 8G of ram, about 1.5G is used when I first boot.


I know there are several other applications that do the same thing (espeically finder). I've noticed that more CPU is used while there's alot of inactive ram. I'm considering to see if snow leopard will handle my ram more efficiently, and possibly use that. (though I wish I could just combine the two).

Apr 14, 2012 1:25 AM in response to 叶from香港

hi

well my mbp 2011 core i5

i had the same problem and i did alot of work on google and did experiment on my mbp

but i had still kernel consuming 300% of cpu usage

finally i did one thing

took out the mbp logic board and wash it and dry it with heat

because some of the censores were not doing proper work but now my mbp is running normally.

i don't know wether u should do it or not but i did and resovled my issue.

kernel_task consumes a lot of RAM in early 2011 MBP, sometimes Finder too

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.