Bug 111210 - Running out of SWT handles / Excessive GDI handles
Summary: Running out of SWT handles / Excessive GDI handles
Status: RESOLVED FIXED
Alias: None
Product: GMF-Runtime
Classification: Modeling
Component: General (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P2 normal
Target Milestone: ---   Edit
Assignee: Steven R. Shaw CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2005-09-30 10:10 EDT by Min Idzelis CLA
Modified: 2006-01-16 09:19 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Min Idzelis CLA 2005-09-30 10:10:17 EDT
I regularly run out of SWT handles when developing my GMF based editor. Did a
little bit of debugging, and found that the animated zoom creates lots of font
objects and never cleans them up. Fonts should probably only be cached for the
current zoom level, and should probably be destroyed when the editor closes. 

I also installed sleak, and looked at the GDI object count in windows task
manager. Zooming the editor one level leaks about 100+ GDI objects, even though
sleak can't detect them. Closing an editor doesn't fix this problem.
Comment 1 Steven R. Shaw CLA 2005-10-03 10:20:24 EDT
The animated zoom will appear to be losing handles, but they are actually 
cached and reused when the user goes to that zoom mode again.  Potentially, we 
should limit the cache to a certain level and clean subsequent creations.

Additional note: there was a serious SWT handle leak in the 3.1 release of 
SWT.  They have subsequently fixed this in 3.1.1.  Can you try upgrading your 
target and see if this is still an issue for you?
Comment 2 Min Idzelis CLA 2005-10-03 11:22:43 EDT
I verified that the excessive handles were fixed by Eclipse 3.1.1. For
reference, the bugs are 

105849   	SWT bugs: GDI Handles leak
106058   	Antialiasing memory leak

However, I still think the animated zoom caches too many font objects. I think
that during animation fonts should not be cached. After editor close all the
fonts should be released. 
Comment 3 Steven R. Shaw CLA 2005-10-03 11:32:18 EDT
Downgraded the severity.  There is room for optimization, but it is no longer 
critical path issue.
Comment 4 Steven R. Shaw CLA 2005-10-05 16:41:39 EDT
I also noticed performance problems with animated zoom as a result of this.  I 
don't think SVG should get re-rendered during animation.  It should just scale 
the existing rendered image instead until the animation is finished... Also, 
font cache should limit itself to avoid caching all possible font sizes on the 
system...Upgrading severity again...
Comment 5 Steven R. Shaw CLA 2005-10-06 14:35:46 EDT
Changing component to "Runtime Diagram"
Comment 6 Steven R. Shaw CLA 2005-10-12 18:27:49 EDT
- AnimatedZoom causes many font GDI objects to be created and cached.  
Additionally ScalableImageFigures are rerendered at each zoom increment.  

Solution: Added listener mechanism to the AnimatedZoomManager to allow 
ScalableFreeformLayeredPane subclass to clear the font cache on Zoom level 
change and turn off rendering capability inbetween animated zoom invocations.

@see DiagramRootEditPart / 
RenderedDiagramRootEditPart#createScalableFreeformLayeredPane
Comment 7 Eclipse Webmaster CLA 2010-07-19 12:30:27 EDT
[GMF Restructure] Bug 319140 : product GMF and component Runtime Diagram was the original product and component for this bug