The garbage collection process is primarily governed by the configuration parameters of the heap. (Heap is that part of the physical memory which is used by the JVM to create objects). The configuration parameters of the heap are – Xms & Xmx. These can be used as –
java –Xms:256m Xmx:1g
Related: Set JVM Heap Size
This indicates that the minimum heap size (indicated by Xms) is 256Mb & the maximum heap size (indicated by Xmx) is 1024Mb.
The garbage collection can be of 2 types namely:
To understand the concept of major/minor gc, we need to understand the concept of young generation.
Young Generation is the pool of temporary objects which are not fully garbage collected initially. When these objects become old, they become part of the Old generation (This is referred as Minor GC) which are then fully garbage collected (referred as Major GC).
The gc type can be identified using a java option as follows –
java HelloWorld
to determine garbage collection, start your app as –java –verbose:gc HelloWorld
The output of above change should be something like –GC 325407K->83000K(776768K), 0.2300771 secs
Java URL Encoder/Decoder Example - In this tutorial we will see how to URL encode/decode…
Show Multiple Examples in OpenAPI - OpenAPI (aka Swagger) Specifications has become a defecto standard…
Local WordPress using Docker - Running a local WordPress development environment is crucial for testing…
1. JWT Token Overview JSON Web Token (JWT) is an open standard defines a compact…
GraphQL Subscription provides a great way of building real-time API. In this tutorial we will…
1. Overview Spring Boot Webflux DynamoDB Integration tests - In this tutorial we will see…
View Comments
nice concept provided in this tutorial about GC.
I have a query :
Enable Sweeping
allow classes to be unloaded so your PermGen never runs out:
-XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
where should I write the above command?
Actually my program is showing sometimes permgen space outofmemory error , so i want to enable permGenSweepingEnable.
I have windows server with tomcat 7 n java 7
Thanks & Regards,
Anjani
Very helpful -- clear and brief. Thank you for posting.