Skip to Main Content

jdk 8 jvisualvm

grimrandApr 30 2018

Just a bit of advice/info.

I have created and compiled the following two classes in Java 8.

When I use jvisualvm the instances under memory seem to continually increment, i cant see why this should be the case..

Regards

package test;

import java.util.ArrayList;;

public class Application {

   ArrayList<Hotel> hotels = new ArrayList<Hotel>();

   Application () {

      hotels.createHotels();

      while (True){

        try {

           System.out.println("sleep");

           Thread.sleep(30000);

        } catch (InterruptedException ex)

`````   {

          System.out.println ("Error");

   

        }

  

      }

  

    }  

    public static void main (String args[]){

      Application app = new Application();

    }

    public ArrayList<Hotel> createHotels(){

       ArrayList<Hotel> tempHotel = new ArrayList<Hotel>();

       for (int i = 0; i < 50; i++){

          Hotel hotel = new Hotel("Test");

          tempHotel.add(hotel);

       }

       return tempHotel;

    }

    

}

package test;

public class Hotel {

   private String name;

   Hotel (String name){

     this.name = name;

   }

   Hotel (){

   }

}

Post Details
Locked due to inactivity on May 28 2018
Added on Apr 30 2018
0 comments
268 views