DEADeveloper Engineering AtlasDeveloper workspace

Local · Your input stays in the browser

JVM Heap Calculator for Xmx, Xms, and Thread Stacks

Estimate Xms, Xmx, and Xss from container, thread-stack, and native-memory budgets.

Workspace

Guide and technical reference

How to use

The calculator subtracts reserve, rounded-up thread stacks, and native memory, assigns 80% of the remainder to Xmx in 16 MiB steps, and sets Xms to half of Xmx with a 128 MiB minimum.

  1. Enter total MiB, reserve, thread count, Xss KiB, and native MiB.
  2. Correct any non-positive or unsafe allocation.
  3. Copy the flags and validate them under a representative workload.

Examples

Input
2048, 256, 200, 1024, 256
Output
stacks 200; remainder 1336; Xmx 1056; Xms 528; margin 280 MiB

This is the fixed reference vector.

Input
threads 0
Output
Input error

Thread count must be a positive integer.

Input
memory 256; reserve 128; native 128
Output
Allocation error

No safe heap budget remains.

Understanding the result

Container memory covers heap, stacks, native memory, metaspace, code cache, and direct buffers.

The safety margin is remainder minus Xmx, not unused container memory in every workload.

Common errors and limitations

  • The formula is a planning estimate, not a universal optimum.
  • Actual native and thread usage must be measured.
  • Xmx is not the container limit.

Frequently asked questions

Why is Xms lower than Xmx?
The current policy starts at half the estimated maximum heap.
Does this prevent OOM?
No. Workload, GC, native allocation, and limits still need observation.

← Back to all tools