Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does allocated size of permanent generation increase after executing perform GC?

Following are the snapshots I took after executing perform GC from jvisualvm. Heap Stats and Permgen Stats

First image is Heap stats and 2nd one is perm gen stats. I am not able to understand when I did GC utilized heap size decreased(as expected) but the allocated size of permanent generation increased (though the utilized permgen size remained the same).What could be the possible explanation of such behavior?

JVM arguments used

-Xbootclasspath/p:../xyz.jar
-Xbootclasspath/a:../abc.jar
-Djava.endorsed.dirs=../resolver
-Djava.library.path=../framework
-Djavax.management.builder.initial=JBeanServerBuilder
-Djavax.net.ssl.trustStore=../certs
-Dorg.mortbay.log.class=JettyLogger
-Xms128m
-Xmx256m
-Xdebug
-Xnoagent
-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=2000

Note : I have changed the name(ex xyz.jar) for propriety reasons.

JVm Info:

JVM: Java HotSpot(TM) 64-Bit Server VM (23.6-b04, mixed mode)
Java: version 1.7.0_11, vendor Oracle Corporation
Java Home: /home/aniket/jdk1.7.0_11/jre
JVM Flags: <none>
like image 972
Aniket Thakur Avatar asked Jul 26 '13 09:07

Aniket Thakur


People also ask

Does increasing heap size improve performance?

You can improve performance by increasing your heap size or using a different garbage collector. In general, for long-running server applications, use the J2SE throughput collector on machines with multiple processors (-XX:+AggressiveHeap) and as large a heap as you can fit in the free memory of your machine.

Is permanent generation part of heap or stack?

The permanent generation is still part of the heap.

Does garbage collection occur in permanent generation space in JVM?

When objects are garbage collected from the Old Generation, it is a major garbage collection event. Permanent Generation: Metadata such as classes and methods are stored in the Permanent Generation. Classes that are no longer in use may be garbage collected from the Permanent Generation.

What is perm gen and other generation for objects?

Permanent Generation or “Perm Gen” contains the application metadata required by the JVM to describe the classes and methods used in the application. Note that Perm Gen is not part of Java Heap memory. Perm Gen is populated by JVM at runtime based on the classes used by the application.


2 Answers

  • The memory-allocation Heap/Perm/Eden/Young/S1/S2 etc spaces depends on the underlying algorithm used for GC.
  • Memory allocation to above spaces are not defined as absolute values parameters. They are defined as ratios to total heap / perm available to JVM.
  • Above two points probably point out that when Heap size changes, all memory allocations to all spaces are re-evaluated to maintain the ratio which are defined.

Below link will be really useful:

http://www.oracle.com/technetwork/java/javase/gc-tuning-6-140523.html

like image 103
Learn More Avatar answered Sep 29 '22 13:09

Learn More


since nobody offers an answer, I make my comment an answer, although it is a little vague:

I'd guess that the GC reevaluates the various sizes it has to control as part of the collection run. So it might decide that it is a little tight on the perm gen side of things an increase it.

like image 37
Jens Schauder Avatar answered Sep 29 '22 11:09

Jens Schauder