Skip to content

Instantly share code, notes, and snippets.

@stingh711
Created July 17, 2012 04:51
Show Gist options
  • Save stingh711/3127246 to your computer and use it in GitHub Desktop.
Save stingh711/3127246 to your computer and use it in GitHub Desktop.
Test minor GC
private static final int _1M = 1024 * 1024;
/**
* Test with -verbose:gc -XX:+PrintGCDetails -Xms20M -Xmx20M -Xmn10M
*/
public void testMinorGc() {
byte[] a1, a2, a3, a4;
a1 = new byte[_1MG / 2];
System.out.println(1);
a2 = new byte[3 * _1MG];
System.out.println(2);
a3 = new byte[2 * _1MG];
System.out.println(3);
a4 = new byte[4 * _1MG];
System.out.println(4);
}
@stingh711
Copy link
Author

Result is:

1
2
3
[GC [DefNew: 5959K->653K(9216K), 0.0121310 secs] 5959K->5773K(19456K), 0.0123050 secs] [Times: user=0.00 sys=0.01, real=0.02 secs]
4
Heap
def new generation total 9216K, used 5163K [0x8e510000, 0x8ef10000, 0x8ef10000)
eden space 8192K, 55% used [0x8e510000, 0x8e977968, 0x8ed10000)
from space 1024K, 63% used [0x8ee10000, 0x8eeb34e8, 0x8ef10000)
to space 1024K, 0% used [0x8ed10000, 0x8ed10000, 0x8ee10000)
tenured generation total 10240K, used 5120K [0x8ef10000, 0x8f910000, 0x8f910000)
the space 10240K, 50% used [0x8ef10000, 0x8f410020, 0x8f410200, 0x8f910000)
compacting perm gen total 12288K, used 91K [0x8f910000, 0x90510000, 0x93910000)
the space 12288K, 0% used [0x8f910000, 0x8f926ec8, 0x8f927000, 0x90510000)
ro space 10240K, 60% used [0x93910000, 0x93f1dba0, 0x93f1dc00, 0x94310000)
rw space 12288K, 61% used [0x94310000, 0x94a72ed0, 0x94a73000, 0x94f10000)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment