Is it possible to limit the memory an application is allowed to use?

I've used tools to effectively reduce the amount of RAM available to all applications, but is there something to do the same on a per application basis?

Specifically, I'm looking to limit the memory usage of Firefox 3.5 on an older machine with just 128MB RAM. Currently, Windows 2000 and ancilliaries (including a basic firewall) consume about 80-85MB. Open a few tabs in Firefox and physical RAM is soon used up causing inevitable slowdown.

Whilst I welcome ideas relating to Firefox, I'd really appreciate a more general approach that I could apply to any application.

Thanks.


Solution 1:

I know this isn't a general approach to limiting the amount of RAM available to the applications, but here is a nice guide to limiting the amount of RAM available to firefox.

I'm not sure if there is a general approach to limiting memory usage for single applications (except for maybe java applications).

Solution 2:

You can use Microsoft's Application Verifier. It doesn't give a lot of options for memory management, but allows to run apps in 'resource constrained' environment. It's primary usage is for profiling/debugging, but it can be used just to constrain bad behaving apps.

Solution 3:

Here's a cure that might be worse than the disease - run the application in a virtual machine. The virtual machine will have a hard limit on the RAM it can utilize.

There's obviously some overhead in creating the virtual machine, but for Firefox you could probably run it in a very small Linux distribution.

Solution 4:

  • Optimize Firefox’s memory usage by tweaking session preferences.
    also read the comments on that page.

  • Optimizing Firefox

  • Use the Session Manager to remember your browser state,
    restart the browser whenever you see its consuming a lot of memory
    (use the process explorer referred below to keep a tab on memory utilization)

  • Install Google Chrome, if just to run its about:memory tab
    check how firefox compares with some other browsers (Opera, IE, etc)

On a slightly separate note, check your firefox plugin list too,
On the matter of Firefox and memory leaks... and links there in.


On the matter of generic memory usage on the Windows system.

  • I have usually seen arbitrary startup applications taking up a lot of memory.
    • You could keep a copy of the excellent ProcessExplorer;
      maybe even replace the task manager with it!
  • Whenever possible restart an application or reboot if you find some system service has taken up too much memory...
    • I find the Symantec AV on my machine keeps taking up memory.