Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 111688 Details for
Bug 244849
[implementation] Memory leak in DeltaProcessingState#externalTimeStamps ?
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix
244849.txt (text/plain), 4.89 KB, created by
Jerome Lanneluc
on 2008-09-04 13:07:38 EDT
(
hide
)
Description:
Proposed fix
Filename:
MIME Type:
Creator:
Jerome Lanneluc
Created:
2008-09-04 13:07:38 EDT
Size:
4.89 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/DeltaProcessor.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeltaProcessor.java,v >retrieving revision 1.326 >diff -u -r1.326 DeltaProcessor.java >--- model/org/eclipse/jdt/internal/core/DeltaProcessor.java 27 Aug 2008 08:59:19 -0000 1.326 >+++ model/org/eclipse/jdt/internal/core/DeltaProcessor.java 4 Sep 2008 17:04:07 -0000 >@@ -1013,8 +1013,10 @@ > if (elementType == IJavaElement.JAVA_PROJECT) { > // project add is handled by JavaProject.configure() because > // when a project is created, it does not yet have a java nature >- if (delta != null && JavaProject.hasJavaNature((IProject)delta.getResource())) { >+ IProject project; >+ if (delta != null && JavaProject.hasJavaNature(project = (IProject)delta.getResource())) { > addToParentInfo(element); >+ this.manager.getPerProjectInfo(project, false /* don't create info */).rememberExternalLibTimestamps(); > if ((delta.getFlags() & IResourceDelta.MOVED_FROM) != 0) { > Openable movedFromElement = (Openable)element.getJavaModel().getJavaProject(delta.getMovedFromPath().lastSegment()); > currentDelta().movedTo(element, movedFromElement); >Index: model/org/eclipse/jdt/internal/core/ClasspathChange.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathChange.java,v >retrieving revision 1.18 >diff -u -r1.18 ClasspathChange.java >--- model/org/eclipse/jdt/internal/core/ClasspathChange.java 27 Jun 2008 16:03:51 -0000 1.18 >+++ model/org/eclipse/jdt/internal/core/ClasspathChange.java 4 Sep 2008 17:04:07 -0000 >@@ -333,26 +333,6 @@ > } > } > addClasspathDeltas(delta, pkgFragmentRoots, IJavaElementDelta.F_REMOVED_FROM_CLASSPATH); >- >- // remember timestamp of jars that were removed (in case they are added as external jar in the same operation) >- for (int j = 0, length = pkgFragmentRoots.length; j < length; j++) { >- PackageFragmentRoot root = pkgFragmentRoots[j]; >- if (root.isArchive() && !root.isExternal()) { >- URI location = root.resource().getLocationURI(); >- File file = null; >- try { >- IFileStore fileStore = EFS.getStore(location); >- file = fileStore.toLocalFile(EFS.NONE, null); >- } catch (CoreException e) { >- // continue >- } >- if (file == null) >- continue; >- long timeStamp = DeltaProcessor.getTimeStamp(file); >- IPath externalPath = new org.eclipse.core.runtime.Path(file.getAbsolutePath()); >- state.getExternalLibTimeStamps().put(externalPath, new Long(timeStamp)); >- } >- } > } else { > // remote project changes > if (this.oldResolvedClasspath[i].getEntryKind() == IClasspathEntry.CPE_PROJECT) { >Index: model/org/eclipse/jdt/internal/core/DeltaProcessingState.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeltaProcessingState.java,v >retrieving revision 1.50 >diff -u -r1.50 DeltaProcessingState.java >--- model/org/eclipse/jdt/internal/core/DeltaProcessingState.java 27 Jun 2008 16:03:51 -0000 1.50 >+++ model/org/eclipse/jdt/internal/core/DeltaProcessingState.java 4 Sep 2008 17:04:07 -0000 >@@ -507,18 +507,33 @@ > > public void saveExternalLibTimeStamps() throws CoreException { > if (this.externalTimeStamps == null) return; >+ >+ // cleanup to avoid any leak ( https://bugs.eclipse.org/bugs/show_bug.cgi?id=244849 ) >+ HashSet toRemove = new HashSet(); >+ if (this.roots != null) { >+ Enumeration keys = this.externalTimeStamps.keys(); >+ while (keys.hasMoreElements()) { >+ Object key = keys.nextElement(); >+ if (this.roots.get(key) == null) { >+ toRemove.add(key); >+ } >+ } >+ } >+ > File timestamps = getTimeStampsFile(); > DataOutputStream out = null; > try { > out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(timestamps))); >- out.writeInt(this.externalTimeStamps.size()); >+ out.writeInt(this.externalTimeStamps.size() - toRemove.size()); > Iterator entries = this.externalTimeStamps.entrySet().iterator(); > while (entries.hasNext()) { > Map.Entry entry = (Map.Entry) entries.next(); > IPath key = (IPath) entry.getKey(); >- out.writeUTF(key.toPortableString()); >- Long timestamp = (Long) entry.getValue(); >- out.writeLong(timestamp.longValue()); >+ if (!toRemove.contains(key)) { >+ out.writeUTF(key.toPortableString()); >+ Long timestamp = (Long) entry.getValue(); >+ out.writeLong(timestamp.longValue()); >+ } > } > } catch (IOException e) { > IStatus status = new Status(IStatus.ERROR, JavaCore.PLUGIN_ID, IStatus.ERROR, "Problems while saving timestamps", e); //$NON-NLS-1$
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 244849
:
110604
|
111688
|
111689