Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipse-dev] Resource leaks


Several users have reported needing to shutdown Eclipse once every day or so because they run out of resource handles.  After a bit of investigation, there seems to be two general sources of the problem:

1) There are lots of resource leaks.  After spending an hour or so with Sleak I easily found several leaks (175393, 175525, 175526, 175534, 175536).  I suggest teams with UI code spend a bit of time with the Sleak tool to root out the obvious leaks. In a backwards compatibility triumph, the original sleak tool written for Eclipse 2.1 works just fine in the latest 3.3 stream builds.  Download and instructions are here:

http://www.eclipse.org/swt/tools.php

2) We rely heavily on permanent global resource caches.  Caching images and colors in permanent caches is easy and convenient. However, when this is done with a large number of images, it can easily result in large Eclipse-based applications running out of handles.  I suggest using permanent caches only for bounded sets of images that are used very frequently.  Larger sets of images, and especially images derived programmatically such as decorators, should really use limited lifetime caches such as the JFace LocalResourceManager.  Note that resources disposed in your plugin's shutdown method, or in a disposeExec on the Display, are effectively permanent resources. If anyone else has suggestions or tips on how to manage resources, please chime in.

Problems like this are a death by a thousand cuts.  Each plug-in may only have one or two tiny leaks, and a handful of global images and colors, so it doesn't feel like a pressing problem.  Scale this up to hundreds or thousands of plug-ins, and you have a stop ship defect that can make Eclipse-based applications unusable.

Back to the top