1

I'd like some inactive processes to app swap into virtual memory, freeing main memory up for other uses.

I have created a few shell scripts - sleepchrome, sleepfirefox, and sleepsafari to sleep an app when I don't want to quit it, but don't want it hogging CPU or memory. The scripts work to prevent CPU usage - they identify and send a SIGSTOP signal to the relevant processes. (Happy to share the code if there's interest - ask a question.)

But for some reason, MacOS seems to be uninterested in swapping them out to virtual memory: Even when there's significant memory pressure, per Activity Monitor, the processes memory usage doesn't decrease.

Is this a bug in the OS? Seems to be. Is there a solution? Perhaps it would require a modification to the apps themselves or a plug-in? (which would make this more of a stackoverflow question)

  • 1
    Which memory usage numbers are you looking at when you say that "the processes' memory usage doesn't decrease"? Some of the usage numbers include memory that's been swapped out. – duskwuff Jan 6 '17 at 3:42
  • 1
    Doesn't the OS already do this? (with App Nap, etc.) – Morgan Rodgers Jan 6 '17 at 4:28
  • @duskwuff answered in OP: "per Activity Monitor". Take your pick. Memory, Compressed Mem, Real Memory Size, Virtual Memory Size, Memory Size, Shared Memory Size, Private Memory Size. Doesn't change in the output of ps either. – Matthew Elvey Jan 9 '17 at 5:47
  • @MorganRodgers: no, it doesn't seem to, and the little documentation I read before asking the question didn't indicate it does, IIRC. It focuses on CPU, not RAM. – Matthew Elvey Jan 9 '17 at 5:47
  • Interesting related question: stackoverflow.com/questions/10775687/… . (P.S. Here's the documentation referred to in my comment immediately above. No mention of memory.) – Matthew Elvey Jan 13 '17 at 2:48

You must log in to answer this question.

Browse other questions tagged .