Memory Configuration
JVM memory flags, off-heap configuration, and memory management for ND4J and DL4J
Overview
JVM Heap Flags
Flag
Purpose
-Xms2G -Xmx8G # Start with 2 GB, allow up to 8 GB
-Xms512m -Xmx2G # Lightweight processOff-Heap Memory Flags
Flag
Purpose
Recommended Configurations
Development workstation (16 GB RAM, CPU only)
Server training (64 GB RAM, CPU only)
GPU training (24 GB VRAM, 64 GB system RAM)
Inference server (low latency, 32 GB RAM, CPU)
GPU Memory Management
Rule of thumb for GPU memory
Minimum GPU VRAM requirements
Using HOST_ONLY memory with CUDA
Memory-Mapped Files
Garbage Collection Configuration
ND4J's periodic GC
JVM GC tuning flags
Diagnosing OOM Errors
Can't allocate [HOST] memory
Can't allocate [HOST] memoryCUDA out of memory
CUDA out of memoryJVM heap OOM
Diagnosing with heap dumps
Monitoring Memory Usage
At runtime
GPU memory
Summary of Common Pitfalls
Pitfall
Effect
Fix
Related Pages
Last updated
Was this helpful?