Skip to content

Instantly share code, notes, and snippets.

@zhuyifan2013
Created February 5, 2020 05:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zhuyifan2013/591c246bcc7fb7913fdc1999e1bb4174 to your computer and use it in GitHub Desktop.
Save zhuyifan2013/591c246bcc7fb7913fdc1999e1bb4174 to your computer and use it in GitHub Desktop.
/**
* VM options: -verbose:gc -Xms:20M -Xms20M -Xmn10M -XX:+PrintGCDetails
*/
public class MemoryAllocate {
private static final int _1mb = 1024 * 1024;
public static void main(String[] args) {
byte[] alloc1, alloc2, alloc3, alloc4;
alloc1 = new byte[2 * _1mb];
alloc2 = new byte[2 * _1mb];
alloc3 = new byte[2 * _1mb];
alloc4 = new byte[4 * _1mb];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment