Skip to content

Commit

Permalink
Merge pull request square#121 from square/py/report_excluded
Browse files Browse the repository at this point in the history
Add excluded refs to leak info
  • Loading branch information
pyricau committed May 18, 2015
2 parents 555c442 + fbdc604 commit 4559d51
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ public static String leakInfo(Context context, HeapDump heapDump, AnalysisResult
} else {
info += "* NO LEAK FOUND.\n\n";
}
if (detailed) {
detailedString += "* Excluded Refs:\n" + heapDump.excludedRefs;
}

info += "* Reference Key: "
+ heapDump.referenceKey
+ "\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,26 @@ private ExcludedRefs(Map<String, Set<String>> excludeFieldMap,
this.excludedThreads = unmodifiableSet(new LinkedHashSet<>(excludedThreads));
}

@Override public String toString() {
String string = "";
for (Map.Entry<String, Set<String>> classes : excludeFieldMap.entrySet()) {
String clazz = classes.getKey();
for (String field : classes.getValue()) {
string += "| Field: " + clazz + "." + field + "\n";
}
}
for (Map.Entry<String, Set<String>> classes : excludeStaticFieldMap.entrySet()) {
String clazz = classes.getKey();
for (String field : classes.getValue()) {
string += "| Static field: " + clazz + "." + field + "\n";
}
}
for (String thread : excludedThreads) {
string += "| Thread:" + thread;
}
return string;
}

public static final class Builder {
private final Map<String, Set<String>> excludeFieldMap = new LinkedHashMap<>();
private final Map<String, Set<String>> excludeStaticFieldMap = new LinkedHashMap<>();
Expand Down

0 comments on commit 4559d51

Please sign in to comment.