Magnum Torch

Magnum Torch

3M Downloads

[Bug]: magnum torch update makes my server to have a memory leak

antoni0C0des opened this issue ยท 1 comments

commented

Mod Loader (Required)

Fabric

Minecraft Version (Required)

1.19.2

Mod Version (Required)

4.2.2

Notes (Required)

Current behavior is that the latest version or magnun torch, for some reason, makes the G1 Eden Space pool to free up memory slower than it should, which causes a memory leak & lags the server. My server has 4,2 gb of ram, and with the version 4.2.1, the G1 Eden Space pool is cleaning up 1,2GB as it should, without decreasing the cleaned mem amount or slower GC collections. The 4.2.2 makes the cleaning rate slower (600 MB or even less) and it also makes the server to not clean up memory when players start loading chunks. This eventually kills the server

latest.log (Optional)

https://mclo.gs/UBlpLh0

commented

So this is quite hard to investigate for me, but I strongly assume it comes from my lazy implementation of the hook used for preventing mob spawns on Fabric.

The thing is, on Forge the event fired whenever and entity is added to the world (from spawning or loading in from saved chunks) the event itself allows for preventing that addition.
The most similar Fabric event does not allow for that, as it fires at a much different stage where the entity is already guaranteed to be added (if I remember correctly). So instead of preventing the addition as I do on Forge instead the entity is immediately removed again, which I assume is causing this issue.
I've now replaced the Fabric event with a custom hook matching the implementation on Forge. I'd assume this is a safe way to go about this, as Forge itself is using this internally to prevent entity spawns blocked by other events, and if there were a similar issue I'm sure it'd have already been noticed.

The new version should be live soon as v4.2.3. If you encounter the issue again please reopen this report.