Skip to content

Visual GC

December 22, 2011

Most of us are aware of the Java Tuning using the heap sizing, GC settings. But there are several more which one can use. Please refer the following websites for more details.

I was curious to know, how the Permgen, Oldgen, Eden spaces look (I can think of Hell or Heaven as no one has experienced 🙂 )

So wrote a small code to test the VisualGC output from JVisualVM and following are few results which you can see. The details need to written as it would consume some more time for me to understand / digest.

public class StudentBean {

private long sId;
private String fName;
private String sName;

private String division;
private String address;

public StudentBean(long sId, String fName, String sName, String division,
String address) {
this.sId = sId;
this.fName = fName;
this.sName = sName;
this.division = division;
this.address = address;

public String toString() {
return “StudentBean [sId=” + sId + “, fName=” + fName + “, sName=”
+ sName + “, division=” + division + “, address=” + address
+ “]”;

public long getsId() {
return sId;
public void setsId(long sId) {
this.sId = sId;
public String getfName() {
return fName;
public void setfName(String fName) {
this.fName = fName;
public String getsName() {
return sName;
public void setsName(String sName) {
this.sName = sName;
public String getDivision() {
return division;
public void setDivision(String division) {
this.division = division;
public String getAddress() {
return address;
public void setAddress(String address) {
this.address = address;


import java.util.Random;

public class StudentTest {

public static void main(String[] args) throws InterruptedException {

Random randomize = new Random();
for(;;) {

StudentBean sBean = new StudentBean(randomize.nextLong(), Integer.toString(randomize.nextInt()), Integer.toString(randomize.nextInt()), Integer.toString(randomize.nextInt()), Integer.toString(randomize.nextInt()));
Thread t = Thread.currentThread();
synchronized (t) {



-Xms128M -Xmx256M

-Xms128M -Xmx256M -Xmn64M

-Xms128M -Xmx256M -Xmn64M -XX:+UseConcMarkSweepGC

-Xms128M -Xmx256M -Xmn64M -XX:+UseParallelGC

-Xms128M -Xmx256M -Xmn64M -XX:+UseSerialGC

I would like to experiment the other options as well. The number of permutations and combinations would be high, but wanted to have a fair idea of how the Java Memory Model changes based on the Java options which are given by the user while invoking the JRE.

Will write a more detailed report(?) based on my understanding / grasping power. 🙂

No comments yet

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: