Last active
December 30, 2015 01:18
-
-
Save rjdkolb/7754974 to your computer and use it in GitHub Desktop.
Simple class to create thousands of classes and test the performance of JEP 149 - OpenJDK 8 against OpenJDK7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ConsumeHeap { | |
public static void main(String []args) throws IOException{ | |
HashMap<Long,Integer> hugeMap = new HashMap<>(); | |
Random rand = new Random(System.currentTimeMillis()); | |
for (int count=0;count <5000000;count++){ | |
long time = System.currentTimeMillis(); | |
hugeMap.put(time, rand.nextInt()); | |
} | |
System.out.println("Done"); | |
System.gc(); | |
System.in.read(); | |
hugeMap.size(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment