Increased memory usage
LJNeon opened this issue ยท 3 comments
I added ferritecore 3.0.1 to a small fabric 1.17.1 server for some friends, and it increased memory usage by over 200MB.
From a client perspective it's a fully vanilla server. The mods installed are as follows:
- Fabric API 0.36.1 (required)
- Lithium 0.7.3 (performance)
- Starlight 1.0.0-RC3 (performance)
- Ledger 1.0.2 (simple logging)
- Fabric Language Kotlin 1.6.2 (dependency of Ledger)
I removed ferritecore and memory usage went back down to previous levels. I'm willing to provide additional information as needed.
I forgot this was still open, sorry. The problem is not as simple as "You have become the very thing you swore to destroy":
I assume you're referring to memory usage as seen by your OS; so in the task manager on windows and top/htop/ps/etc on linux. This is virtually impossible to influence directly in Java, the only reliable way to change it is to change the amount of memory you're assigning to MC (e.g. -Xmx1G
). Inside that memory Java keeps "permanent" as well as "temporary" objects. The temporary objects are created and immediately discarded, but still use up memory until the garbage collection removes them. You generally want the amount assigned to Java to be something like the amount needed for permanent objects plus some constant amount as space for temporary objects between GCs. FerriteCore reduces the amount needed for the permanent objects, so you should be able to assign less memory to get the same amount of space for temporary objects.
You can test this by forcing a full GC using jcmd <PID> GC.run
. This will typically and in my experience cause Java to actually give the memory it doesn't really need back to the OS, but it is not guaranteed to do that AFAIK.
This gist provides misinformation about FerriteCore and this specific issue.