Unnecessary FullGC seems to run. REPRODUCING and BEHAVIOR: The attached test progtam, GCBeanTEST.java tries to allocate 4M memory 100 times. 1) Compile the test program and invoke the following command line. java -Xms64m -XX:+UseSerialGC -XX:NewRatio=12 -verbose:gc GCBeanTEST NOTE: -XX:+UseSerialGC and -XX:NewRatio=12 is added to avoid that runtime system considers the PC as "server" machine.(to avoid auto-configuration) The following message will appear K:\shares2\gc>java -Xms64m -XX:+UseSerialGC -XX:NewRato=12 -verbose:gc GCBeanTEST [GC 285K->133K(65088K), 0.0046967 secs] [Full GC 133K->133K(65088K), 0.0156947 secs] [GC 4229K->4229K(65088K), 0.0006263 secs] [Full GC 4229K->133K(65088K), 0.0160146 secs] [GC 4229K->4229K(65088K), 0.0004048 secs] [Full GC 4229K->133K(65088K), 0.0281636 secs] [GC 4229K->4229K(65088K), 0.0003623 secs] [Full GC 4229K->133K(65088K), 0.0186784 secs] [GC 4229K->4229K(65088K), 0.0003084 secs] [Full GC 4229K->133K(65088K), 0.0153316 secs] .......... sun.management.GarbageCollectorImpl@82c01f, sun.management.GarbageCollectorImp @133796] ----- Copy ----- sun.management.GarbageCollectorImpl@82c01f GarbageCollectorMXBean.getName():Copy GarbageCollectorMXBean.getCollectionCount():100 GarbageCollectorMXBean.getCollectionTime():1962 ------------------------------------ ----- MarkSweepCompact ----- sun.management.GarbageCollectorImpl@133796 GarbageCollectorMXBean.getName():MarkSweepCompact GarbageCollectorMXBean.getCollectionCount():0 GarbageCollectorMXBean.getCollectionTime():0 ------------------------------------ INVESTIGATION: The messages by -verbose:gc ... [GC 4229K->4229K(65088K), 0.0003084 secs] [Full GC 4229K->133K(65088K), 0.0153316 secs] .... says GC anf Full GC occurs 100 times respectively. CopyGC and FullGC seems to occur per one allocation. The following scenario seems to happen. 1) The runtime system tries to allocate object to Eden, but fails because allocation size is bigger than Eden Size. 2) The runtime system tries to copy GC, but fails. 3) FullGC runs and allocate the object to tenured area. EXPECTED BEHAVIOR: .... [GC 4229K->4229K(65088K), 0.0003084 secs] [Full GC 4229K->133K(65088K), 0.0153316 secs] .... The above listed FullGC seems unnecessary. Such FullGC is hoped not to run.
|