C2ME-fabric
C2ME-fabric copied to clipboard
Fix vanilla chunk system
Describe the bug Loading chunks slowly causes the game to leak memory, with the ingame allocation showing at 100%, but the OS showing memory usage creeping up until the OS kills the process. I have 16GB allocated to Minecraft, but after leaving the game running for a while, the OS shows usage up to 24GB+.
To Reproduce Steps to reproduce the behavior:
- Fly around loading chunks
- OS shows memory usage slowly creeping up until the process is killed by the OS.
Runtime info (please complete the following information):
- OS: Pop!_OS 22.04
- Minecraft version: 1.19
- Mod version: tested on 0.2.0+alpha.8.2 from CurseForge as well as dev release 0.2.0+alpha.8.4
Crash reports / logs https://pastebin.com/c2GDmPLP
Other mods None, just C2ME on Fabric.
Checklist
- [x] I am using the official version of the mod.
- [x] I tried the latest development version but the issue persists.
- [x] I searched for similar open issues and could not find an existing bug report on this.
If you think that's a memory leak please provide a heap dump (using spark for example) in order to make this issue valid and allow us to work on the data.
Here is a heap dump for my game, made using Spark.
That's a huge heap dump. Please compress the heap dump with gzip or something else.
Sorry about that! I reproduced the issue with less memory allocated (only 8GB this time instead of 16GB), made another heap dump, and compressed it with 7zip so the download is only about 1GB now. Here you go.
This feels like a large issue with vanilla's chunk system when chunk generates and loads too fast and it literally cannot handle this. We are working for a solution but there is no ETA.
Alright, thanks for looking into it! I just found it very strange because the memory doesn't seem to get freed even after staying in one place for a long time, and the memory even seems to stay allocated (well past 100% allocation) upon leaving a world, requiring a restart to return to anything near the heap size I set via Java args.
after trying with java arguments it works slightly better but still strugeling
standart server arguments (aikar flags)
-XX:+UseG1GC -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -XX:G1NewSizePercent=40 -XX:G1MaxNewSizePercent=50 -XX:G1HeapRegionSize=16M -XX:G1ReservePercent=15 -XX:InitiatingHeapOccupancyPercent=20 -Dusing.aikars.flags=https://mcflags.emc.gs -Daikars.new.flags=true --add-modules=jdk.incubator.vector
my mods
I have the same issue as well, whenever I generate a new world the game gives me constant lag spikes and show extremely high memory usage in task manager after just a few minutes of playing. Mojang seriously screwed everyone over by not overhauling the chunk generation system during the development of 1.18 (and no I'm not talking about terrain generation, that's a separate topic).
I have the same issue as well.
A leak has been fixed on 1.20.x, 1.19.4, 1.19.2 and 1.18.2. Try reproduce with the versions that match your minecraft found on modrinth: https://modrinth.com/mod/c2me-fabric/versions
Just tested on Fedora 38 with Minecraft 1.20.1 with version 0.2.0+alpha.10.100. I did quite a lot of flying around in a similar manner to my original report and saw no indication of a leak, with in-game usage never going above around 50%, and with OS memory usage capping at around 9GB with 8GB heap allocation to the game. I have significantly different hardware from when I made my original report, so I can't perfectly replicate the conditions of the original test, but it does seem like the issue is fixed.