Community
Participate
Working Groups
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.
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?
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.
Downgraded the severity. There is room for optimization, but it is no longer critical path issue.
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...
Changing component to "Runtime Diagram"
- 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
[GMF Restructure] Bug 319140 : product GMF and component Runtime Diagram was the original product and component for this bug