Over a million developers have joined DZone.

VisualVM: See (What's in) Your Heap!

DZone's Guide to

VisualVM: See (What's in) Your Heap!

Get an overview of VisuaVM 1.3.7 including new features and improvements.

· Java Zone ·
Free Resource

Download Microservices for Java Developers: A hands-on introduction to frameworks and containers. Brought to you in partnership with Red Hat.

The newly released VisualVM 1.3.7 introduces several cool new features. The most interesting one is displaying "logical value" of objects in the heap browser, including for example String values, File paths and even a preview of UI elements. More details are provided below in the article.

Application JFrame rendered from .hprof heap snapshot

The other improvements in this release include displaying Park state in the Threads view, support for remote memory sampling (Java 8 applications) and displaying Total time values in CPU Hot Spots. The instrumenting Profiler now calibrates JVMs of target applications as needed and allows to manage the calibration data (Tools | Options | Profiling). JMX Connections newly provide an option to not require SSL to suppress security warnings.

Let's explore the heap viewer improvements in more details. The first change is displaying logical values of objects in all views. This includes String-based objects (String, File or URL), Number-based objects (Integer, Long or Float), basic AWT classes (Point, Dimension or Rectangle), Reference objects, Thread objects and many other types.

String values of ThreadGroups and Threads

To provide more information for the selected object, a special preview area has been added to the Instances view. Full String value or primitive array items are displayed here as well as Color, Font or Image previews.

Preview of an int[] array

The preview area can also render selected UI elements like labels or buttons or content of containers like panels and frames up to the main application window. This way the heap viewer helps to visualize the application state at the point when an OutOfMemoryError occured, discover leaking dialogs and identify duplicate resources.

JPanel rendered from .hprof heap snapshot

Go and download VisualVM for free to see what's in your heap!

Download Building Reactive Microservices in Java: Asynchronous and Event-Based Application Design. Brought to you in partnership with Red Hat

java ,tips and tricks ,visualvm ,tools & methods

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}