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
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