liveBook · Manning

Chapter 11: Finding memory-related issues in an app’s execution

What you will learn in chapter 11 of Troubleshooting Java: Read, debug, and optimize JVM applications

This introduction explains the consequences of poor memory management and why heap dumps can help investigate crashes.

After this chapter you will be able to

What it builds on

Section by section

Introduction

This introduction explains the consequences of poor memory management and why heap dumps can help investigate crashes.

Key terms: memory allocation, memory management, GC, CPU, heap dump, allocated memory, profiling

11.1 Sampling and profiling for memory issues

This section uses VisualVM memory sampling and targeted profiling to investigate excessive object allocation and locate the code responsible.

Key terms: garbage collector, Monitor tab, memory widget, Sampler tab, Memory button, Live Bytes, Live Objects, Memory settings, fully qualified name, package

11.2 Using heap dumps to find memory leaks

This section explains how memory leaks can crash a JVM application and why heap dumps help investigate memory issues when profiling is unavailable.

Key terms: memory leak, memory allocation, OutOfMemoryError, heap dump, heap memory, profiler

11.2.1 Obtaining a heap dump

This section explains how to obtain heap dumps automatically on a memory error, from a running process, or programmatically.

Key terms: OutOfMemoryError, -XX:+HeapDumpOnOutOfMemoryError, HeapDumpPath, heap dump, VisualVM, Heap Dump button, Monitor tab, jps, jmap, PID

11.2.2 Reading a heap dump

This section explains how to use VisualVM to examine a heap dump, identify memory-heavy application objects, and investigate their references.

Key terms: heap dump, heap, allocated memory, VisualVM, summary view, Objects view, instances, occupied memory, Product, instance

11.2.3 Using the OQL console to query a heap dump

This section introduces using OQL in VisualVM to query heap dumps, compare app versions, and investigate potential memory leaks.

Key terms: OQL, heap dump, instances, fully qualified name, references, JSON, conditions, values, referrers(), referrals

11.3 Summary

Concepts explained in this chapter

← Chapter 10: Investigating deadlocks with thread dumps Chapter 12: Investigating apps’ behaviors in large systems →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.