Investigate Memory Leaks and High Memory Usage
View Memory Usage by Class
When your server's memory usage climbs or doesn't recover after restarts, use the heap summary to see which Java classes are consuming the most memory.
1. Run /spark heapsummary (or access via health report)
2. Look for unexpectedly large entries—these indicate where memory is being held
3. Cross-reference class names with plugins or game systems
Take a Heap Dump for Deep Analysis
If memory keeps growing despite restarts, a heap dump captures the entire JVM memory state for offline analysis.
1. Run /spark heapdump when memory usage is high
2. Spark saves a snapshot file to your server directory
3. Use external tools (like Eclipse MAT or JProfiler) to analyze the dump and trace object references
Monitor Garbage Collection
Frequent or long garbage collection pauses cause lag. Check /spark healthreport for GC activity. If GC is running constantly, your server is running out of heap space—consider allocating more RAM or reducing player/entity count.