Possible additional information on memory leaks
theRookieCoder opened this issue ยท 6 comments
Version information
mc1.18.2-0.4.1+build.15
Expected Behaviour
I'm the developer of SnowyLeavesPlus and my mod adds a block state to leaf blocks. It also registers a colour provider that changes leaf blocks' colour based on the block state.
I took a debug stick and spam cycled the snowiness
block state on a leaf without Sodium and the colour changed somewhat smoothly.
Actual Behaviour
I then tried the exact same thing with Sodium. Firstly, the block colour took a long time to update, around 2-5 seconds. If I check the console, there are tons of warnings:
[Render thread/WARN] (NativeBuffer) Reclaimed X bytes at address Y that were leaked from an unknown location (logging is disabled)
This memory leak too doesn't occur in vanilla.
Steps to Reproduce
- Install SnowyLeavesPlus, Fabric API, and Sodium.
- Choose the snowiness property of any leaf block using a debug stick.
- Spam right click to continuously cycle the block state.
- Notice that the colour takes a long time to change, and that there are memory leak warnings in the logs.
Java version
Temurin 17.0.2
CPU
Intel Core i5-8210Y
GPU
Intel UHD Graphics 617 GL version 4.1
Additional information
macOS 12.3
Thanks for the analysis. It seems we have a bug in the way we're handling very frequent block updates, which causes Sodium to lose track of the already in-flight chunk updates, resulting in the memory leak and the very slow block updates.
Version information
0.4.1
Expected Behavior
No big memory problem.
Actual Behavior
My logs are getting spammed with bytes of memory being reassigned because of some memory leak. Additionally, if I walk through a forest, my FPS absolutely tanks and then the game sometimes crashes from this. It's like the forest just adds too much stuff for the already overflowing memory to handle and it just shuts down.
Reproduction Steps
It seems to basically always happen while inside of a world.
Java version
Java 17
CPU
intel core i5
GPU
Intel Iris x
Seems to have been fixed, not sure when though. The latest version mc1.19.3-0.4.9+build.23
shifts the colour smoothly and doesn't yield any memory leak warnings.
@NealSavage could you test again on the latest version? I'm not sure if your problem is related to this. If it isn't, it could be forgotten about since I've closed the issue