Parallel Old collectors are JAVA one of the garbage collectors in a virtual machine. like the Serial old collector, it works in the older era of JAV virtual machines. This garbage collector uses multithreading and the "mark-and-organize" algorithm. It is only available in JDK 1.6 .
in the focus on throughput and CPU resource-sensitive situations, they can be given priority Parallel Scavenge Plus Parallel Old Collector.
1 , run code
Package COM.GC;
Import java.util.ArrayList;
Import java.util.List;
/**
* simple. JAVA Virtual machine Memory Reclamation , parallel old Use of Collectors
* Parameters: -xms30m-xmx60m-xmn10m-xx:+useparalleloldgc-xx:+printgcdetails
* @author Fan Fangming
*/
public class Easyparallelold {
Public byte[] PlaceHolder =new byte[64 * 1024x768];// placeholder
public static Voidmain (string[] args) throws exception{
Outofmemorybyexpansionsize ();
}
private static Voidoutofmemorybyexpansionsize () throws exception{
List<easyparallelold>list = new arraylist<easyparallelold> ();
while (true) {
easyparalleloldserial = new Easyparallelold ();
List.add (serial);
Thread.Sleep (Ten);// Pause Ten milliseconds
}
}
}
2 , Parameters
-xms30m-xmx60m-xmn10m-xx:+useparalleloldgc-xx:+printgcdetails
-xms30m JVM Minimum 30M
-xmx100m JVM Maximum 100M
-xmn10m Cenozoic Fixed 10M
-xx:+ USEPARALLELOLDGC corresponding parallel scavenge +parallel old Collecting Device
-xx:+printgcdetails Print Details GC
3 , running results
...
[Full GC [psyounggen:3394k->3394k (6848K)] [paroldgen:50664k->50664k (51200K)]54058k->54058k (58048K) [ PSPERMGEN:2084K->2084K (12288K)], 0.0043610 secs][times:user=0.00 sys=0.00, real=0.00 secs]
[Full GC [psyounggen:3394k->3394k (6848K)] [paroldgen:50728k->50728k (51200K)]54122k->54122k (58048K) [ PSPERMGEN:2084K->2084K (12288K)], 0.0071480 secs][times:user=0.00 sys=0.00, real=0.01 secs]
[Full GC [psyounggen:3394k->3394k (6848K)] [paroldgen:50792k->50792k (51200K)]54186k->54186k (58048K) [ PSPERMGEN:2084K->2084K (12288K)], 0.0061676 secs][times:user=0.00 sys=0.00, real=0.01 secs]
[Full GC [psyounggen:3394k->3394k (6848K)] [paroldgen:50856k->50856k (51200K)]54250k->54250k (58048K) [ PSPERMGEN:2084K->2084K (12288K)], 0.0047575 secs][times:user=0.00 sys=0.00, real=0.00 secs]
[Full GC [psyounggen:3394k->3394k (6848K)] [paroldgen:50920k->50920k (51200K)]54314k->54314k (58048K) [ PSPERMGEN:2084K->2084K (12288K)], 0.0044603 secs][times:user=0.00 sys=0.00, real=0.00 secs]
[Full GC [psyounggen:3394k->3394k (6848K)] [paroldgen:50984k->50984k (51200K)]54378k->54378k (58048K) [ PSPERMGEN:2084K->2084K (12288K)], 0.0041311 secs][times:user=0.00 sys=0.00, real=0.00 secs]
[Full GC [psyounggen:3394k->3394k (6848K)] [paroldgen:51048k->51048k (51200K)]54442k->54442k (58048K) [ PSPERMGEN:2084K->2084K (12288K)], 0.0042710 secs][times:user=0.00 sys=0.00, real=0.00 secs]
[Full GC [psyounggen:3394k->3394k (6848K)] [paroldgen:51112k->51112k (51200K)]54506k->54506k (58048K) [ PSPERMGEN:2084K->2084K (12288K)], 0.0044147 secs][times:user=0.00 sys=0.00, real=0.00 secs]
[Full GC [psyounggen:3394k->3394k (6848K)] [paroldgen:51176k->51176k (51200K)]54570k->54570k (58048K) [ PSPERMGEN:2084K->2084K (12288K)], 0.0044082 secs][times:user=0.00 sys=0.00, real=0.00 secs]
[Full GC [psyounggen:3394k->3394k (6848K)] [paroldgen:51176k->51176k (51200K)]54570k->54570k (58048K) [ PSPERMGEN:2084K->2084K (12288K)], 0.0044738 secs][times:user=0.00 sys=0.00, real=0.01 secs]
Exception in thread "main" Java.lang.OutOfMemoryError:Java heap space
atcom.gc.easyparnew.<init> (easyparnew.java:12)
atcom.gc.EasyParNew.outOfMemoryByExpansionSize (easyparnew.java:39)
Atcom.gc.EasyParNew.main (easyparnew.java:14)
Heap
Psyounggen total 6848K, used 3456K [0x0ad30000, 0x0b730000, 0x0b730000)
Eden Space 3456K, 100% used [0x0ad30000,0x0b090000,0x0b090000)
From space 3392K, 0% used [0x0b090000,0x0b090000,0x0b3e0000)
To space 3392K, 0% used[0x0b3e0000,0x0b3e0000,0x0b730000)
Paroldgen total 51200K, used 51176K [0x07b30000, 0x0ad30000, 0x0ad30000)
Object Space 51200K, 99% used [0x07b30000,0x0ad2a0a0,0x0ad30000)
Pspermgen total 12288K, used 2105K [0x03b30000, 0x04730000, 0x07b30000)
Object Space 12288K, 17% used [0x03b30000,0x03d3e4a8,0x04730000)
4 , and serial Old Differences in Collectors
serial Old collectors are serialized for garbage collection, while Parallel Old collectors are garbage collected in parallel.
[Full GC [psyounggen:3394k->3394k (6848K)] [paroldgen:51048k->51048k (51200K)]54442k->54442k (58048K) [ PSPERMGEN:2084K->2084K (12288K)], 0.0042710 secs][times:user=0.00 sys=0.00, real=0.00 secs]
And
[GC [defnew:9108k->966k (9216K), 0.0049332 secs][tenured:46824k->46893k (46920K), 0.0033687 secs] 47800k-> 47790K (56136K), [perm:2086k->2086k (12288K)], 0.0084489 secs] [times:user=0.02 sys=0.00,real=0.01 secs]
Paroldgen said is parallel old in the age of recycling;
Tenured means that serial old is recycled in the older years.
Java garbage collector's parallel old collector