package benchmark; | |
public class GCBenchmark { | |
private static class MemoryAllocator { | |
private int[] buffer; | |
private MemoryAllocator(int size) { | |
this.buffer = new int[size]; | |
} | |
public static MemoryAllocator alloc(int sizeMB) { | |
return new MemoryAllocator(sizeMB * 1024 * 1024 / 4); | |
} | |
} | |
public static void main(String[] args) { | |
for (int i = 0; i < 100; i++) { | |
MemoryAllocator.alloc(5); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment