1

I am running a computational process that requires several GBs of memory. When my process consumes about 11Gbs, Activity Monitor shows me that kernel_task consumes more than 20Gbs thus making my system run out of memory. I need my process to finish the computation, but with kernel_task eating all the memory, the process will not finish in any reasonable time. Why is kernel_task consuming so much memory and is there a way to let it know not to? Hibernation is OFF, opening windows on restart is OFF.

My system: OSX 10.9.2, 32Gb of RAM

  • Could you expand on what exactly that computational process is doing? - especially which types of system calls does it use? - I'm assuming that you don't have the problem on every boot, but just when running that program. – jksoegaard May 15 '14 at 19:09
  • the kernel_task is likely your process. You can try freeing up "inactive memory" with the purge command in Terminal, just type purge and hit return when the inactive memory gets to be a good percentage of the used memory. – chillin May 16 '14 at 0:48
  • @jksoegaard the process reads in a file of ids and their frequencies, and builds Huffman codes for these ids. It puts all ids-frequency pairs onto a heap and builds a tree by pull things of the heap. There may be tens of millions of these ids, so the tree may get pretty big. – lynxoid May 17 '14 at 17:18
  • I see my process separately (huffman) and it takes 10-12Gb, kernel_task takes up to 20Gb on top of that. I will try purge Monday :) – lynxoid May 17 '14 at 17:20
  • @lynxoid you forgot to mention which system calls your program uses? try tracing it to see what kind of kernel-interaction happens... this will lead you on track to discover why kernel_task takes up that much memory – jksoegaard May 18 '14 at 11:03
2

The kernel_task process in question is likely your process running.

You can try freeing up "inactive memory" with the purge command in Terminal, just type purge and hit return when the inactive memory gets to be a good percentage of the used memory.

You can also try running your process without the gui, or without the window server running. This will free up memory and processor resources.

  • Set your login window to require name and password from the accounts control panel in system preferences, turn off auto login if enabled.

  • Then reboot to free up memory.

  • from the login window (if set as username/password) type >console in the name field, hit enter, and when the window server quits...

  • log in at the console, shortname & enter password when prompted

  • type screen and hit return

screen man page - so you can have another term to watch with top; will use less resources than running gui. control-a then c to create new terminal, control-a then n to move between the two scrreens

run your process in one, run top -u -s5 to run a utility like activity monitor so you can monitor your process

when done, just exit out of both screens, and then exit out of the console to launch the window server and return the login window and back to gui

  • I run the process from a command line already, it has no gui (see comment to the original post). However, I'll try running w/o the window server. Thanks for the tip! – lynxoid May 17 '14 at 17:21
  • 1
    @lynxoid you misunderstand! You're likely originally running within Terminal, that's in a window, outside the window are other windows, menu bar, task bar items, menues, icons, Desktop, Dock. That is what we call the Graphical User Interface, aka GUI - Console Mode runs without the overhead of the ENTIRE GUI, no windows, no window server, the loginwindow process, no Finder, no Menus, no Pointer, no Dock. Its a considerable amount of resources and memory that were tied up in the GUI that your process and the kernel task have access to because they're not being used. See my answer above. Thanks. – chillin May 17 '14 at 21:21
  • You meant a window manager for the OS - I got it, thanks for your answer. – lynxoid Oct 7 '14 at 20:12
1

This is actually something that Apple actually built into the system, rather bizarre but it was intentional. See this post from Apple: https://support.apple.com/en-us/HT207359

However, if you are running a secondary monitor or a high-resolution monitor then try the following: change your monitor setting from 1080 psf (which is the default) to 1080 p. We were having this problem and the tech support at Resolve figured it out. No more kernel task error nor out of memory problems. Good luck to anyone having this issue.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .