Over a million developers have joined DZone.

Visual GC

DZone's Guide to

Visual GC

Free Resource

Transform incident management with machine learning and analytics to help you maintain optimal performance and availability while keeping pace with the growing demands of digital business with this eBook, brought to you in partnership with BMC.

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 I wrote a small code to test the VisualGC output from JVisualVM and following are a 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. :)

Evolve your approach to Application Performance Monitoring by adopting five best practices that are outlined and explored in this e-book, brought to you in partnership with BMC.


Published at DZone with permission of Jagannathan Asokan, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.


Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.


{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}