TreeMap
Archie Cobbs
archie at whistle.com
Tue Sep 26 14:20:06 PDT 2000
I've checked in that patch.. but here's a question. Why doesn't
kaffe (with the old TreeMap) run out of memory when the program
below is run? Maybe just chance?
-Archie
___________________________________________________________________________
Archie Cobbs * Whistle Communications, Inc. * http://www.whistle.com
import java.util.*;
public class TreeMapTest {
public static void main(String[] args) {
long seed = System.currentTimeMillis();
if (args.length > 0)
seed = Long.parseLong(args[0]);
System.out.println("Random seed is " + seed);
Random r = new Random(seed);
TreeMap t = new TreeMap();
for (int i = 0; i < 10000000; i++) {
Integer value = new Integer(r.nextInt() % 37);
if (r.nextBoolean())
t.put(value, null);
else
t.remove(value);
}
System.out.print("Keys:");
for (Iterator i = t.keySet().iterator(); i.hasNext(); )
System.out.print(" " + i.next());
System.out.println();
System.out.println("Free mem: "
+ Runtime.getRuntime().freeMemory());
}
}
More information about the kaffe
mailing list