diff --git a/gc/boehm/leaksoup/leaksoup.java b/gc/boehm/leaksoup/leaksoup.java index 88bf3de04b18..b1f78145578f 100644 --- a/gc/boehm/leaksoup/leaksoup.java +++ b/gc/boehm/leaksoup/leaksoup.java @@ -37,39 +37,6 @@ import java.io.*; import java.util.*; -class Type { - String mName; - int mSize; - - Type(String name, int size) { - mName = name; - mSize = size; - } - - public int hashCode() { - return mName.hashCode() + mSize; - } - - public boolean equals(Object obj) { - if (obj instanceof Type) { - Type t = (Type) obj; - return (t.mSize == mSize && t.mName.equals(mName)); - } - return false; - } - - public String toString() { - return "<" + mName + "> (" + mSize + ")"; - } - - static class Comparator implements QuickSort.Comparator { - public int compare(Object obj1, Object obj2) { - Type t1 = (Type) obj1, t2 = (Type) obj2; - return (t1.mSize - t2.mSize); - } - } -} - class Leak { String mAddress; Type mType; @@ -176,19 +143,6 @@ final class LineReader { } } -class StringTable { - private Hashtable strings = new Hashtable(); - - public String intern(String str) { - String result = (String) strings.get(str); - if (result == null) { - result = str; - strings.put(str, str); - } - return result; - } -} - public class leaksoup { private static boolean ROOTS_ONLY = false; @@ -353,6 +307,7 @@ public class leaksoup { } // print the object histogram report. + out.println("

Leak Histogram:

"); printHistogram(out, hist); // open original file again, as a RandomAccessFile, to read in stack crawl information. @@ -388,17 +343,17 @@ public class leaksoup { } static void printHistogram(PrintWriter out, Histogram hist) throws IOException { - // sort the objects by histogram count. - Object[] objects = hist.objects(); + // sort the types by histogram count. + Object[] types = hist.objects(); QuickSort sorter = new QuickSort(new HistComparator(hist)); - sorter.sort(objects); + sorter.sort(types); - out.println("

Leak Histogram:

"); out.println("
");
-		int count = objects.length;
-		while (count > 0) {
-			Object object = objects[--count];
-			out.println(object.toString() + " : " + hist.count(object));
+		int index = types.length;
+		while (index > 0) {
+			Type type = (Type) types[--index];
+			int count = hist.count(type);
+			out.println(type.toString() + " : " + count + " {" + (count * type.mSize) + "}");
 		}
 		out.println("
"); }