Skip to content

Commit

Permalink
Bug 582305 Improve Leak Suspects report for references in paths
Browse files Browse the repository at this point in the history
Fix command printing for commands such as:
path2gc 0x0 -exclude;
where the -exclude was omitted leading to default values being used
next time.
Use excludes on path2gc root for single object leak to find involved
thread.

Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=582305
Change-Id: I6f56548a6be6e0dc34e4536b6a563c729bf9b9f6
  • Loading branch information
ajohnson1 committed Sep 23, 2023
1 parent 1d9a40c commit 9b72f85
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -461,11 +461,12 @@ else if (snapshot.isClass(accumulationPointId))
{
IResult result = SnapshotQuery.lookup("path2gc", snapshot) //$NON-NLS-1$
.setArgument("object", describedObject) //$NON-NLS-1$
.setArgument("excludes", excludes) //$NON-NLS-1$
.execute(listener);
qspath = new QuerySpec(Messages.LeakHunterQuery_ShortestPaths, result);
StringBuilder sb = new StringBuilder("path2gc"); //$NON-NLS-1$
sb.append(" 0x").append(Long.toHexString(describedObject.getObjectAddress())); //$NON-NLS-1$
//addExcludes(sb);
addExcludes(sb);
qspath.setCommand(sb.toString());
// See if the end of the path is a thread
if (!isThreadRelated && result instanceof IResultTree && result instanceof ISelectionProvider)
Expand Down Expand Up @@ -1022,13 +1023,17 @@ void addExcludes(StringBuilder sb)
if (excludes != null && !excludes.isEmpty() || hasDefault)
{
sb.append(" -excludes"); //$NON-NLS-1$
if (excludes != null)
if (excludes != null && !excludes.isEmpty())
{
for (String ex : excludes)
{
sb.append(' ').append(Converters.convertAndEscape(String.class, ex));
}
}
else
{
sb.append(' ');
}
sb.append(';');
}
}
Expand Down Expand Up @@ -1345,6 +1350,7 @@ private ThreadInfoQuery.Result extractThreadData(SuspectRecord suspect, Set<Stri
{
IResultTree tree = (IResultTree) SnapshotQuery.lookup("merge_shortest_paths", snapshot) //$NON-NLS-1$
.setArgument("objects", acc) //$NON-NLS-1$
.setArgument("excludes", excludes) //$NON-NLS-1$
.execute(listener);
for (Object row : tree.getElements())
{
Expand Down

0 comments on commit 9b72f85

Please sign in to comment.