MacOS – kernel_task consuming a lot of memory, can’t finish the computations

macosmemory

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

Best Answer

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