11

Similar to this: How to "hibernate a process" under Linux/Windows?

Are there any methods to hibernate a process in a way that it doesn't stay in memory? E.g.: If I don't want to use Firefox, and don't want to close the process of it, and I need free memory, then how can I really hibernate the process so the memory reserved by Firefox is freed up?

I need solution for both Windows and Linux!

6 Answers 6

5
+100

If I don't want to use Firefox, and don't want to close the process of it, and I need free memory, then how can I really hibernate the process so the memory reserved by Firefox is freed up?

For Windows, there is Free Process Freezer.

For Linux and Mac OS X, there is CrypoPID, as mentioned in yeedl's answer.


If you want to come up with a custom solution:

Look into process dumping on Windows, eg. ProcDump, resume it with a CLI debugger from WinDBG.

Look into core dumping on Linux, eg. core, resume it with a CLI debugger like GNU GDB.

I bet a software based solution that doesn't involve a debugger is possible, but that's for Stack Overflow.


You're looking for a very specific use case, why don't just suspend and let it swap out?

You would be spending more time on getting your processes running and suspending...

I believe you can optimize your workflow in another way that would be more seamless.

5

Both Windows and Linux/Unix provide a way to suspend or stop a process from executing, by removing it from the list of runnable processes.

This doesn't directly affect the memory pages owned by a process, but over time as the system comes under pressure for memory those pages will be good candidates to swap out to disk.

Trying to write out a process to disk for later resumption isn't going to work for anything non-trivial. Open handles to the network and windowing system will fail as soon as the process resumes.

2
  • It wouldn't work for anything trivial either. :) +1
    – user541686
    Jun 9, 2011 at 14:51
  • 1
    Those open handles are just opened again or stored along, so that isn't really a problem... Jun 14, 2011 at 11:21
2

I know in firefox you can save a session.

In Linux, this can be done with CrypoPID.

This question and this one try to answer it for Windows, but I couldn't find a great solution of saving an application state to a file like I did for linux.

1

For Windows:

I don't know any way to completely evict a process from memory without killing it, but you can trim its working set by minimizing its main window. Microsoft has an article explaining this: The working set of an application is trimmed when its top-level window is minimized.

So, first minimize the main window(s), then suspend the process as suggested in the question you linked.

You can accomplish both with the ever-useful Process Explorer.

  • Right click process, Window -> Minimize
  • Right click again, Suspend.
1

On Windows, some programs can swap-out "unused" program memory.
An example of a product that can do that is the commercial Process Lasso.
However, even Process Lasso counsels against that practice.

From The Truth about Windows Memory Optimizers :

It is best to leave the management of virtual memory to Windows and not take it into your own hands. Any benefit from these programs is an illusion and temporary. You incur the penalties of paging memory back in sooner or later, even if it appears that the program you run after the cleanup loads faster.

Now as regarding Firefox, see mozillaZine's Reducing memory usage - Firefox, which contains lots of advice on how to discover which extensions leak memory.

There is also the Firefox extension Memory Fox which :

Attempting to reduce the browser's RAM Memory usage promoting the increase of available RAM memories for other application processes RAM memory requirements. Hopefully, fostering any attempts of Memory Recovery and Retention.

In my experience this extension only postpones the inevitable memory-bloat of Firefox. The only real solution is to close Firefox from time to time to liberate memory.

1

You can send STOP signal to processes in Linux. A stopped process is like paused. To resume it send the process CONT signal. To send the signal you can do this:

kill -STOP process_id

kill -CONT process_id

A stopped process will be swapped out if system requires more memory.

You must log in to answer this question.

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