Skip to content

Instantly share code, notes, and snippets.

@rednaxelafx
Created January 15, 2012 07:52
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 rednaxelafx/1614952 to your computer and use it in GitHub Desktop.
Save rednaxelafx/1614952 to your computer and use it in GitHub Desktop.
example of DirectByteBuffer instances that die in young gen get processed by ParNew GC
D:\experiment>set JAVA_OPTS=-Xmx64m -Xms64m -Xmn20m -XX:+UseConcMarkSweepGC -XX:+PrintGCDetails
D:\experiment>groovysh
[GC [ParNew: 16384K->2048K(18432K), 0.0169505 secs] 16384K->2114K(63488K), 0.0179312 secs] [Times: u
ser=0.05 sys=0.00, real=0.02 secs]
Groovy Shell (1.8.4, JVM: 1.6.0_30)
Type 'help' or '\h' for help.
---------------------------------------------------------------------------------------------------
[GC [ParNew: 18432K->2048K(18432K), 0.0720667 secs] 18498K->7179K(63488K), 0.0727480 secs] [Times: u
ser=0.19 sys=0.00, real=0.07 secs]
groovy:000> java.nio.Bits.reservedMemory
===> 0
groovy:000> java.nio.ByteBuffer.allocateDirect(8)
===> java.nio.DirectByteBuffer[pos=0 lim=8 cap=8]
groovy:000> java.nio.Bits.reservedMemory
===> 8
groovy:000> 100000.times { [:] }
[GC [ParNew: 18432K->2048K(18432K), 0.0941397 secs] 23563K->10591K(63488K), 0.0948446 secs] [Times:
user=0.09 sys=0.00, real=0.09 secs]
[GC [ParNew: 18432K->1971K(18432K), 0.0174726 secs] 26975K->12535K(63488K), 0.0180691 secs] [Times:
user=0.05 sys=0.00, real=0.02 secs]
===> null
groovy:000> java.nio.Bits.reservedMemory
===> 0
groovy:000> quit
Heap
par new generation total 18432K, used 6755K [0x00000000f6e00000, 0x00000000f8200000, 0x00000000f8
200000)
eden space 16384K, 29% used [0x00000000f6e00000, 0x00000000f72ac040, 0x00000000f7e00000)
from space 2048K, 96% used [0x00000000f7e00000, 0x00000000f7fece00, 0x00000000f8000000)
to space 2048K, 0% used [0x00000000f8000000, 0x00000000f8000000, 0x00000000f8200000)
concurrent mark-sweep generation total 45056K, used 10564K [0x00000000f8200000, 0x00000000fae00000,
0x00000000fae00000)
concurrent-mark-sweep perm gen total 21248K, used 17186K [0x00000000fae00000, 0x00000000fc2c0000, 0
x0000000100000000)
D:\experiment>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment