Bug 153601 - [performance] small leak of wst jst classes when you create a web page in a dynamic web project
Summary: [performance] small leak of wst jst classes when you create a web page in a d...
Status: CLOSED FIXED
Alias: None
Product: WTP Java EE Tools
Classification: WebTools
Component: jst.j2ee (show other bugs)
Version: 1.5   Edit
Hardware: PC Windows XP
: P2 major (vote)
Target Milestone: 1.5.1 M151   Edit
Assignee: Chuck Bridgham CLA
QA Contact: Chuck Bridgham CLA
URL:
Whiteboard: review
Keywords: performance
: 154188 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-08-11 12:33 EDT by John Lanuti CLA
Modified: 2006-09-07 09:08 EDT (History)
2 users (show)

See Also:


Attachments
Perf patches (1.84 KB, patch)
2006-08-21 16:04 EDT, Chuck Bridgham CLA
no flags Details | Diff
New Patch (8.06 KB, patch)
2006-08-22 10:01 EDT, Chuck Bridgham CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Lanuti CLA 2006-08-11 12:33:38 EDT
In IBM product on RAD

1. Create a web project with faces
2. Create  web page say about 8 or 10 pages
3. close all editors.
4. delete the web project
5. If you look at the objects in the heap, there are quite a few 




org.eclipse.jst.j2ee.componentcore.J2EEModuleVirtualComponent
	+8	+0 %	+256	+0 %	9	0 %	288	0 %
	 org.eclipse.jst.common.jdt.internal.integration.ui.WTPUIWorkingCopyManager
	+8	+0 %	+320	+0 %	8	0 %	320	0 %
	 org.eclipse.jst.common.jdt.internal.integration.JavaArtifactEditModel
	+8	+0 %	+896	+0 %	8	0 %	896	0 %
org.eclipse.wst.common.internal.emfworkbench.validateedit.ResourceStateValidatorImpl
	+8	+0 %	+192	+0 %	8	0 %	192	0 %
	 org.eclipse.wst.common.internal.emfworkbench.integration.EditModel$ResourceAdapter
	+8	+0 %	+128	+0 %	8	0 %	128	0 %
	 org.eclipse.wst.common.internal.emfworkbench.edit.ClientAccessRegistry
	+8	+0 %	+128	+0 %	8	0 %	128	0 %
	 org.eclipse.wst.common.internal.emf.resource.Translator[]
	+8	+0 %	+384	+0 %	8	0 %	384	0 %
	 org.eclipse.wst.common.componentcore.internal.resources.VirtualFolder
	+8	+0 %	+256	+0 %	9	0 %	288	0 %
	 org.eclipse.wst.common.componentcore.internal.impl.ComponentResourceImpl
	+8	+0 %	+448	+0 %	8	0 %	448	0 %


The common pattern of the leak was JavaArtifactEditModel being in memory, FacetProject also was in memorry, see below

 org.eclipse.jst.common.jdt.internal.integration.JavaArtifactEditModel (#00a43ba4)
			 [29] of  java.lang.Object[38] (#00f0cc41)
				 elementData of  java.util.ArrayList (#00e14529)
					 listeners of  org.eclipse.wst.common.project.facet.core.internal.FacetedProject (#013e7b3e)
						 value of  java.util.HashMap$Entry (#00b6e32d)
							 [7] of  java.util.HashMap$Entry[16] (#0020b894)
								 table of  java.util.HashMap (#00527fae)
									 projects of  org.eclipse.wst.common.project.facet.core.internal.ProjectFacetsManagerImpl (#01c03a2e)
										 impl of  org.eclipse.wst.common.project.facet.core.FacetedProjectFramework (#0104a74c)
Comment 1 Chuck Bridgham CLA 2006-08-17 11:35:34 EDT
*** Bug 154188 has been marked as a duplicate of this bug. ***
Comment 2 Chuck Bridgham CLA 2006-08-21 16:04:16 EDT
Created attachment 48325 [details]
Perf patches
Comment 3 Chuck Bridgham CLA 2006-08-21 16:09:11 EDT
I found a couple problems with our disposal methods on EditModel and 
ResourceSetWorkbenchEditSynchronizer

The Editmodel was calling the privateMethod "doDispose()" directly from the releaseAccess method when the reference had gone to 0, thus ignoring any subclass overrides of "dispose()"

I changed to call dispose() directly - which also handles the "startdispose()"

The Synchronizer class was holding on to an instance of a resourceDelta, even after disposal....   these can be quite large - also nulled out the "extenders" list

Submitting for review....
Comment 4 Jason Sholl CLA 2006-08-21 16:18:14 EDT
approve
Comment 5 Michael D. Elder CLA 2006-08-21 17:24:08 EDT
Won't the addition of the @Override annotation cause a build brekage?
Comment 6 Chuck Bridgham CLA 2006-08-21 19:00:15 EDT
Hmm not sure... this was just added via the eclipse source stub wizard... I can remove it.
Comment 7 Daniel Berg CLA 2006-08-22 08:51:55 EDT
Reject

The problem I have is with the dispose() method on EditModel.  In the superclass the startDispose() method is setting the isDispossing flag.  In doDispose() the PRE_DISPOSE notification is sent and the isDispossing flag is set back to false.  The problem I have is that subclasses are overriding the dispose method.  This is bad because the PRE_DISPOSE event is not fired consistently and the isDispossing flag is not set correctly for the subclasses.  I spoke with Jason and we have a proposed change for this problem.  He will attach another patch.
Comment 8 Chuck Bridgham CLA 2006-08-22 10:01:04 EDT
After discussing with Jason and Dan we have decided to restrict the use of dispose() in the subclasses, and exposed doDispose() because of timing issues with the disposing flags etc...

new patch attached
Comment 9 Chuck Bridgham CLA 2006-08-22 10:01:24 EDT
Created attachment 48370 [details]
New Patch
Comment 10 Narinder Makin CLA 2006-08-22 11:21:06 EDT
Though it;s internal,
are these extenders of this class that need to react to this change or is this just been done in the base and will not impact any extenders?
Comment 11 Daniel Berg CLA 2006-08-22 11:58:20 EDT
Approve
Comment 12 Chuck Bridgham CLA 2006-08-23 09:35:07 EDT
Dropped to build
Comment 13 John Lanuti CLA 2006-08-28 16:39:20 EDT
OK
Comment 14 David Williams CLA 2006-09-07 09:08:50 EDT
performance bugs should use performance keyword (no need to use [performance] in summary).