liveBook · Manning

-Xms

As explained in Troubleshooting Java, Second Edition

-Xms is a JVM startup property that sets the initial heap size available to a Java application.

-Xms sets the minimum initial heap size available to a Java application. For example, -Xms500m gives the JVM an initial heap size of 500 MB. section 5.2.3

Use -Xms when investigating memory pressure alongside GC behavior and -Xmx. Larger settings can provide short-term relief, but they do not fix memory leaks or unnecessary allocations. section 11.4.3 section 5.2.3

Interpret memory observations before changing the setting:

  • Peaks and valleys suggest that garbage collection is reclaiming memory; steadily increasing usage suggests a possible leak. section 11.4.3
  • Frequent full GC events and heap usage close to its maximum indicate increasing performance and OutOfMemoryError risk. section 11.4.3
  • Treat a larger initial heap as temporary mitigation, then investigate object retention with a heap dump or application changes. section 5.2.3
[GC pause (G1 Evacuation Pause) (mixed), 0.01506789 secs]
[GC pause (G1 Evacuation Pause) (mixed), 0.01783456 secs]
[GC pause (G1 Evacuation Pause) (mixed), 0.02021234 secs]

[Full GC (Allocation Failure) 8192M->6100M(8192M), 2.345678 secs]
[GC pause (G1 Evacuation Pause) (mixed), 0.01901234 secs]
[GC pause (G1 Evacuation Pause) (mixed), 0.02115678 secs]

[Full GC (Allocation Failure) 8192M->5800M(8192M), 2.678901 secs]
[GC pause (G1 Evacuation Pause) (mixed), 0.0987654 secs]
[GC pause (G1 Evacuation Pause) (mixed), 0.02254321 secs]

[Full GC (Allocation Failure) 8192M->5600M(8192M), 2.789012 secs]

Inspect full-GC log entries to connect allocation failure, retained heap, and pause duration with suspected memory pressure. section 11.4.3

How Troubleshooting Java, Second Edition covers it

How deep it goes
Defines the setting and applies it to GC symptoms, but stops short of JVM heap-sizing internals.
Examples
Uses -Xms500m, GC log entries, memory graphs, and an ArrayList-based OutOfMemoryError scenario.
What it assumes
Assumes basic Java application knowledge while introducing heap sizing, garbage collection, and memory-leak symptoms.
What you can do after
Diagnose memory pressure with GC observations and apply -Xms as temporary heap-capacity mitigation.
How it connects
Connects -Xms with JVM heap, -Xmx, garbage collection, memory leaks, heap dumps, and OutOfMemoryError.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Troubleshooting Java, Second Edition. The section links point to the parts of the book it draws on.