This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 213632 - Memory leak in LogContext
Summary: Memory leak in LogContext
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Parsing & Indexing (show other bugs)
Version: 7.2
Hardware: PC Linux
: P3 normal (vote)
Assignee: Tomas Zezula
URL:
Keywords: PERFORMANCE
Depends on:
Blocks:
 
Reported: 2012-06-05 21:20 UTC by Jesse Glick
Modified: 2012-06-08 06:10 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2012-06-05 21:20:57 UTC
Found a leaked closed project in a dev build.

this	org.netbeans.modules.apisupport.project.NbModuleProject
project	org.netbeans.modules.apisupport.project.Evaluator
evaluator	org.netbeans.spi.java.project.classpath.support.ProjectClassPathImplementation
impl	org.netbeans.api.java.classpath.ClassPath
key	java.util.HashMap$Entry
[3]	java.util.HashMap$Entry[]
table	java.util.HashMap
map	java.util.HashSet
classPathsChanged	org.netbeans.modules.parsing.impl.indexing.LogContext
[16]	org.netbeans.modules.parsing.impl.indexing.LogContext[]
contexts	org.netbeans.modules.parsing.impl.indexing.LogContext$RingTimeBuffer
value	java.util.HashMap$Entry
[3]	java.util.HashMap$Entry[]
table	java.util.HashMap
history	org.netbeans.modules.parsing.impl.indexing.LogContext$Stats
STATS	org.netbeans.modules.parsing.impl.indexing.LogContext

Perhaps classPathsChanged and fileObjsChanged could be WeakSet's?
Comment 1 Tomas Zezula 2012-06-06 08:19:41 UTC
Thanks for report.
Comment 2 Tomas Zezula 2012-06-06 10:05:18 UTC
Fixed jet-main 1a0e47125012
Comment 3 Jesse Glick 2012-06-06 14:01:01 UTC
I had considered Set<String> classPathsChanged but was worried this would not work correctly: a caller might add ClassPath@1 "a.jar" and later add ClassPath@1 "a.jar:b.jar" and you would have two entries rather than one; or a caller might add ClassPath@1 "a.jar" and then ClassPath@2 "a.jar" and you would have one entry rather than two. Not clear to me whether such things matter in this case. If they do, then a WeakSet<ClassPath> would probably work better.
Comment 4 Tomas Zezula 2012-06-06 15:13:17 UTC
This should not matter, the method is called in short time period when collecting source paths in GPR.
The WeakReference<CP> will not work. The LogContext class keeps LogContexts executed in last 2 minutes. If it will try to get the CP from the weak reference if will be null for closed projects.
Comment 5 Quality Engineering 2012-06-08 06:10:52 UTC
Integrated into 'main-golden', will be available in build *201206080001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/1a0e47125012
User: Tomas Zezula <tzezula@netbeans.org>
Log: #213632:Memory leak in LogContext