Java: Difference between revisions

282 bytes added ,  6 years ago
no edit summary
No edit summary
No edit summary
Line 69: Line 69:


===Garbage Collection=== <!--T:11-->
===Garbage Collection=== <!--T:11-->
Java uses an automatic system called ''garbage collection'' to identify variables which are out of scope and return the memory associated with them to the operating system which however doesn't stop many Java programs from requiring significant amounts of memory to run correctly.
By default, the Java VM uses a parallel garbage collector (GC) and sets a number of GC threads equal to the number of CPU cores on a given node, whether a Java job is threaded or not. Each GC thread consumes memory. Moreover, the amount of memory each GC thread consumes is proportional to the amount of physical memory. Therefore, we highly recommend matching the number of GC threads to the number of CPU cores you requested from the scheduler in your job submission script, like so <tt>-XX:ParallelGCThreads=12</tt> for example. You can also use the serial garbage collector by specifying the following option <tt>-XX:+UseSerialGC</tt>, whether your job is parallel or not.
By default, the Java VM uses a parallel garbage collector (GC) and sets a number of GC threads equal to the number of CPU cores on a given node, whether a Java job is threaded or not. Each GC thread consumes memory. Moreover, the amount of memory each GC thread consumes is proportional to the amount of physical memory. Therefore, we highly recommend matching the number of GC threads to the number of CPU cores you requested from the scheduler in your job submission script, like so <tt>-XX:ParallelGCThreads=12</tt> for example. You can also use the serial garbage collector by specifying the following option <tt>-XX:+UseSerialGC</tt>, whether your job is parallel or not.


cc_staff
318

edits