KeepResident Eclipse plugin

August 18, 2004: New version 0.2 available!


  • Updated slider display to display in megabytes rather than bytes.
  • Unlock previously-locked memory if VirtualLock() checkbox is cleared.
  • Use VirtualQueryEx() to find memory regions to lock. This seems to be more stable than the old technique, so if you were having problems before, this may fix them.
  • Temporarily disable VirtualLock() toggle before trying VirtualLock(), so if it crashes, the plugin won't try again the next time it is loaded.
Download the Windows binary for Eclipse 3.0 here. Eclipse 2.1 users can try this version here. I haven't tested the Eclipse 2.1 version, so please let me know if it works or not.

The performance of Eclipse (and other large Java applications) has long suffered due to the Windows virtual memory manager. Windows has a tendency to preemptively swap Java processes out of physical memory, even when there is still plenty of physical memory available. This interacts very poorly with Java processes, which do not have good locality and touch a lot of memory. The problem is exacerbated when Java performs garbage collection, which causes the Java process to touch lots of memory that has been paged out to disk. Ever had Eclipse randomly hang for 15-20 seconds? This is most likely the culprit.

I wrote a simple plugin for Eclipse that uses two functions in the Windows API - SetProcessWorkingSetSize() and VirtualLock() - to encourage Windows to keep more of the Eclipse Java process in physical RAM. This plugin adds a preference page where you can adjust the minimum and maximum working set size (i.e. the amount of memory Windows is supposed to keep in physical memory when the process is in use). However, Windows will happily begin swapping out Eclipse below the working set size if the Eclipse window is minimized. By enabling the VirtualLock checkbox, the plugin will force Windows to allocate physical memory, so even when Eclipse is minimized it won't be swapped out. This is very effective in eliminating that sluggishness in Eclipse after not using it for a while.

(Yes, this is an evil nasty hack. But it's an evil nasty hack that works really well.)

Rate this plugin at Eclipse Plugin Central!