Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simple Java program - profiling shows unexpected behavior

Given an extremely simple java program, shown below, I start the program and profile with VisualVM.

public class test {

   public static void main(String args[]) throws InterruptedException{
      Thread.sleep(10000000L);
   }

}

As can be seen by the below metrics, something behind the scenes just keeps on ticking. What could possibly be going on behind the scenes here? I also included a screenshot of the "Sampler" memory and it looks as if a bunch of primitive arrays just keep getting created, why is this?

enter image description here

enter image description here

like image 329
Jason Avatar asked Jan 23 '26 20:01

Jason


1 Answers

You are connected to the process with VisualVM. Obviously, it takes some work to present you with the fact that the JVM is doing some work :) In specific detail, data is being collected and sent over the JMX connection. Some garbage is created.

like image 184
Marko Topolnik Avatar answered Jan 25 '26 11:01

Marko Topolnik



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!