Skip to main content

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

In reference to 2), one such permanent resource allocation occurs with the
use of decorators in Viewers such as the Outline, Package Explorer, etc.

If you have 8 types of objects (meaning Images) displayed in a view, with
four decorator locations, and each location having just 2 states, that's
648 unique Images needed just to support all the combinations for *only* 16
Images.  I'm pretty sure that these Images are subject to being globally
cached due to the way the decorators are chained off each other.

Using the "owner draw" function added in 3.2, the Images could now just be
painted on top of each other rather than composited into a single Image.
This seems like it could take a huge chunk out of the ~700 GDI objects
allocated by the SDK.

-Randy



                                                                           
             John Arthorne                                                 
             <John_Arthorne@ca                                             
             .ibm.com>                                                  To 
             Sent by:                  eclipse-dev@xxxxxxxxxxx             
             eclipse-dev-bounc                                          cc 
             es@xxxxxxxxxxx                                                
                                                                   Subject 
                                       [eclipse-dev] Resource leaks        
             02/26/2007 11:11                                              
             AM                                                            
                                                                           
                                                                           
             Please respond to                                             
                 "General                                                  
                development                                                
              mailing list of                                              
                the Eclipse                                                
                 project."                                                 
             <eclipse-dev@ecli                                             
                 pse.org>                                                  
                                                                           
                                                                           





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.
_______________________________________________
eclipse-dev mailing list
eclipse-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe
from this list, visit
https://dev.eclipse.org/mailman/listinfo/eclipse-dev




Back to the top