Eclipse Memory Analyzer reports block state data as memory leak
My modded server has recently been running out of memory (30 Gb) every 5-30 minutes, no matter if there's 2 people online or 10. We have suspected a memory leak, so I used spark to create a heap dump, and sent it through the leak finder in Eclipse Memory Analyzer. The results (as can be seen in the attached image) report that the suspected leak is “net.minecraft.world.level.block.state.BlockState”. Is there anything I can do to optimize this or stop it from using so much memory?

7 Replies
Thanks for asking your question!
Make sure to provide as much helpful information as possible such as logs/what you tried and what your exact issue is
Make sure to mark solved when issue is solved!!!
/close
!close
!solved
!answered
Requested by la__la#0
Okay
30 GB of ram is too much. You're supposed to use max 16 GB of ram (suggested would be between 6 or 8)
If you're using Akair flags and a docker container or a pterodactyl panel, make sure you don't have a flag called -xx: alwayspretouch
Use the mod spark for performance profiling
this report is only showing 4.3 gb
That too
You're asking "How do I load less world", with your question "stop it from using so much memory (2.2GB worth)"
That isn't a lot of memory.
Lower your xmx.
!oom
My server is using too much memory
My panel says my memory usage is high all the time.
Your server runs in the Java Virtual Machine (JVM), which has significant overhead & tries to effectively use ALL of the memory assigned to it.
Memory usage from "htop", Task Manager, or your server panel is the total consumption of the JVM, not just your server.
My server is lagging & I think it's memory related.
It's much more likely that you are bottlenecked by your CPU, disk, or some inefficient mod/plugin.
Rule of thumb, servers should have anywhere from 4GB to 12GB of memory, with 8GB being the 'sweet spot'.
If you're heavily modded, add 4GB to that.
Too much memory can be a bad thing. Don't exceed these caps unless you really know why you're doing it.
Troubleshoot your server the right way: use Spark & send us a report.
My server is randomly terminated unexpectedly.
Setting your server to use 8GB does not mean that Java won't exceed this amount.
As a rule of thumb, allow your system/container about 1-2GB (possibly more) overhead outside of the server.
If you're on Linux & can SSH into the system, check your kernel logs. They will report any incidents of OOM.
I want to use swap to allocate more memory.
Don't. Swap is not free memory and using it can negatively impact performance.
Admincraft Canned Responses
Your server isn't likely actually using all the memory you're allocating to it, you're just reserving all your system memory to Java based on your startup flags. Lower your xmx to like 8GB.