Foam​Fix

Foam​Fix

97M Downloads

FoamyExtendedBlockState minecraft:water Memory Leak (client only)

KaktuszSok opened this issue · 2 comments

commented

Hey, 2 of the last 3 custom modpacks I ran on my server had consistent memory leak issues for all players, meaning they had to restart the game every few hours or, in more complex areas, every hour or even more often. The issue happens regardless of any of the JVM arguments we tried as well as when using OpenJ9.

I took the following steps to try and track down the problem:

  1. Launched the modpack with 8GB RAM (also happens with less, i.e. 6GB) and logged in to a singleplayer world
  2. Left the game on overnight (much longer than needed to reproduce this issue)
  3. After returning, the game was frozen as the GC could not manage to free up enough space for new objects.
  4. Opened VisualVM and took a heapdump of the game at this point.
  5. Compared it to a heapdump I took of the game fresh after logging in to a world, where the memory usage was 3.2GB after a GC and went up to about 4.5GB.

Here is the heapdump when the game is overfilled:
image
As can be seen in "Classes by Size of Instances", com.google.common.collect.SingletonImmutableBiMap and pl.asie.foamfix.common.FoamyExtendedBlockState are taking up ~1.5GB each. In the freshly loaded game heapdump, they only take about 600MB each.

Looking into these instances, they all seem to be block states for minecraft:water, and the SingletonImmutableBiMap instances are all key-value pairs where the key is "level" and the value is the water level.
image

The issue happens after AFKing on a superflat world too. Quitting to menu does not fix it, a full game restart is required.

This is likely a mod compat issue. I couldn't figure out which mod in particular causes this but it doesn't happen when foamfix is not installed. The only mods that were in both modpacks that had this issue but not in the one that didn't were: MovingQuickly, bettercaves, EnderStorage and OpenComputers. Removing MovingQuickly did not get rid of the leak. It might be bettercaves but it makes no sense that the leak is present on client and not on server. We have no EnderStorage or OpenComputers blocks placed in our world. This leads me to believe it may be caused by one of the many other mods provided in the modlist below. Any tips on making finding said mod easier are appreciated.

Mod list: https://pastebin.com/me9v1hSn
Log:
2021-03-15-1.log

commented

The memory leak seems to have been caused by a concerning - performance-wise, at least - design decision in Railcraft, however it is an issue specific to FoamFix. It has been fixed in 0.10.12.

commented

Hey!

This doesn't seem to be caused by the deduplicator; could you send me a full copy of the modpack? For now, you can work around this by disabling coremod.smallPropertyStorage.