Bug 49741 - setting runtime classpath leaks an Image
Summary: setting runtime classpath leaks an Image
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows 2000
: P3 major (vote)
Target Milestone: 3.0 M9   Edit
Assignee: Darin Wright CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2004-01-08 16:53 EST by Grant Gayed CLA
Modified: 2004-04-05 16:10 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Grant Gayed CLA 2004-01-08 16:53:37 EST
M6

- ensure you have a java project in your workspace
- in the Java perspective, invoke Run -> Run...
- select tree item Java Applet, press New
- in the new tab folder go to the Classpath tab
- select User Entries
- press Add Projects...
- check one or more projects in the subsequent dialog, OK
- a new item is added as a child of User Entries, this new item is the one 
whose Image is being leaked

Here's a trace of the Image's creation:

  at org.eclipse.swt.graphics.Device.new_Object(Device.java:648)
  at org.eclipse.swt.graphics.Image.<init>(Image.java:629)
  at org.eclipse.jface.resource.ImageDescriptor.createImage
(ImageDescriptor.java:135)
  at org.eclipse.jface.resource.ImageDescriptor.createImage
(ImageDescriptor.java:94)
  at org.eclipse.jface.resource.ImageDescriptor.createImage
(ImageDescriptor.java:83)
  at org.eclipse.ui.model.WorkbenchLabelProvider.getImage
(WorkbenchLabelProvider.java:129)
  at 
org.eclipse.jdt.internal.debug.ui.launcher.RuntimeClasspathEntryLabelProvider.ge
tImage(RuntimeClasspathEntryLabelProvider.java:59)
  at org.eclipse.jdt.internal.debug.ui.classpath.ClasspathLabelProvider.getImage
(ClasspathLabelProvider.java:37)
  at org.eclipse.jface.viewers.TreeViewer.doUpdateItem(TreeViewer.java:99)
  at org.eclipse.jface.viewers.AbstractTreeViewer$UpdateItemSafeRunnable.run
(AbstractTreeViewer.java:87)
  at org.eclipse.core.internal.runtime.InternalPlatform.run
(InternalPlatform.java:813)
  at org.eclipse.core.runtime.Platform.run(Platform.java:457)
  at org.eclipse.jface.viewers.AbstractTreeViewer.doUpdateItem
(AbstractTreeViewer.java:469)
  at org.eclipse.jface.viewers.StructuredViewer$UpdateItemSafeRunnable.run
(StructuredViewer.java:119)
  at org.eclipse.core.internal.runtime.InternalPlatform.run
(InternalPlatform.java:813)
  at org.eclipse.core.runtime.Platform.run(Platform.java:457)
  at org.eclipse.jface.viewers.StructuredViewer.updateItem
(StructuredViewer.java:1285)
  at org.eclipse.jface.viewers.AbstractTreeViewer.createTreeItem
(AbstractTreeViewer.java:383)
  at org.eclipse.jface.viewers.AbstractTreeViewer$1.run
(AbstractTreeViewer.java:363)
  at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:84)
  at org.eclipse.jface.viewers.AbstractTreeViewer.createChildren
(AbstractTreeViewer.java:349)
  at org.eclipse.jface.viewers.AbstractTreeViewer.setExpandedState
(AbstractTreeViewer.java:1347)
  at org.eclipse.jdt.internal.debug.ui.classpath.ClasspathContentProvider.add
(ClasspathContentProvider.java:44)
  at 
org.eclipse.jdt.internal.debug.ui.classpath.RuntimeClasspathViewer.addEntries
(RuntimeClasspathViewer.java:120)
  at org.eclipse.jdt.internal.debug.ui.actions.AddProjectAction.run
(AddProjectAction.java:128)
  at 
org.eclipse.jdt.internal.debug.ui.actions.RuntimeClasspathAction$1.widgetSelecte
d(RuntimeClasspathAction.java:137)
  at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:89)
  at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
  at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:833)
  at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2318)
  at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1999)
  at org.eclipse.jface.window.Window.runEventLoop(Window.java:586)
  at org.eclipse.jface.window.Window.open(Window.java:566)
  at 
org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog.op
en(LaunchConfigurationsDialog.java:440)
  at org.eclipse.debug.ui.DebugUITools$1.run(DebugUITools.java:390)
  at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:84)
  at org.eclipse.debug.ui.DebugUITools.openLaunchConfigurationDialogOnGroup
(DebugUITools.java:394)
  at org.eclipse.debug.ui.DebugUITools.openLaunchConfigurationDialogOnGroup
(DebugUITools.java:336)
  at org.eclipse.debug.ui.actions.OpenLaunchDialogAction.run
(OpenLaunchDialogAction.java:79)
  at org.eclipse.jface.action.Action.runWithEvent(Action.java:842)
  at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection
(ActionContributionItem.java:509)
  at org.eclipse.jface.action.ActionContributionItem.access$2
(ActionContributionItem.java:461)
  at org.eclipse.jface.action.ActionContributionItem$5.handleEvent
(ActionContributionItem.java:408)
  at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82)
  at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:833)
  at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2318)
  at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1999)
  at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1506)
  at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1482)
  at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:246)
  at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:139)
  at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:47)
  at org.eclipse.core.internal.runtime.PlatformActivator$1.run
(PlatformActivator.java:226)
  at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:85)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
  at java.lang.reflect.Method.invoke(Method.java:324)
  at org.eclipse.core.launcher.Main.basicRun(Main.java:279)
  at org.eclipse.core.launcher.Main.run(Main.java:742)
  at org.eclipse.core.launcher.Main.main(Main.java:581)
Comment 1 Darin Wright CLA 2004-01-22 22:44:17 EST
I can't make this happen. When I step through the code, the image is disposed. 
The label provider is disposed on the viewer's dispose callback.
Comment 2 Darin Wright CLA 2004-01-22 22:44:31 EST
Please verify, Darin (S).
Comment 3 Grant Gayed CLA 2004-01-29 17:26:16 EST
Note that I still see this in the 0129 integration build.
Comment 4 Darin Swanson CLA 2004-02-23 18:03:15 EST
I am just not getting to this one...
Comment 5 Darin Wright CLA 2004-03-25 08:57:49 EST
Deferred (yet again)
Comment 6 Darin Swanson CLA 2004-04-02 17:37:15 EST
Using OptimizeIt on I20040330, I see an Image that is not disposed but as 
DarinW indicated it looks like the code is doing the right thing.
Comment 7 Darin Swanson CLA 2004-04-02 18:00:21 EST
You can reproduce the problem just by having a Project entry...or any entry 
that eventually deferred to the WorkbenchLabelProvider of the 
RuntimeClasspathEntryLabelProvider of the ClasspathLabelProvider.

The ClasspathLabelProject was not disposing the 
RuntimeClasspathEntryLabelProvider it created. Therefore any images created by 
the WorkbenchLabelProvider were not disposed.

Fixed in ClasspathLabelProvider.
Comment 8 Darin Swanson CLA 2004-04-02 18:01:01 EST
Please verify DarinW.
Comment 9 Darin Wright CLA 2004-04-05 16:10:37 EDT
Verified.