Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jvisualvm difference between live objects and allocated objects

Tags:

java

jvisualvm

As seen in the screenshot here, 0 live objects, 9 allocated objects. What's the difference between a live and an allocated object ?

jvisualvm screenshot

like image 922
Anonym Avatar asked Jan 27 '11 20:01

Anonym


People also ask

What is live object in Java?

The live objects are those objects that haven't been reclaimed by the garbage collector; this may include objects that are unreachable, and will definitely include objects that are still in use by the application.

What is VisualVM sampler?

Sampler panel: A simple sampling profiler You can control the sampling frequency and how often VisualVM updates the visualization. You can either profile CPU or Memory. Key Takeaway: Don't run a profiler in production.

How use VisualVM performance testing?

Under the Local node in the Applications window, right-click the application node and choose Open to open the application tab. Click the Profiler tab in the application tab. Click Memory or CPU in the Profiler tab. When you choose a profiling task, VisualVM displays the profiling data in the Profiler tab.


2 Answers

The number of allocated objects is not the number of objects not yet reclaimed by the garbage collector. Rather, it is the number of objects created since application start, or since a reset of the "Collected Results Buffer" in VisualVM (there is a button in the memory profiler view to reset the collected results buffer).

The live objects are those objects that haven't been reclaimed by the garbage collector; this may include objects that are unreachable, and will definitely include objects that are still in use by the application.

like image 91
Vineet Reynolds Avatar answered Oct 16 '22 14:10

Vineet Reynolds


  • Allocated objects are all objects that have been created since application start (or reset)
  • Live objects are reachable objects that are being actively used by your program (likely still in the Young Generation)
like image 31
Luciano Fiandesio Avatar answered Oct 16 '22 16:10

Luciano Fiandesio