Sodium

Sodium

35M Downloads

Possible additional information on memory leaks

theRookieCoder opened this issue ยท 6 comments

commented

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

  1. Install SnowyLeavesPlus, Fabric API, and Sodium.
  2. Choose the snowiness property of any leaf block using a debug stick.
  3. Spam right click to continuously cycle the block state.
  4. 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

commented

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.

commented

This happens to me too and I don't have snowyleaves

commented

Hope that additional information helps!

commented

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

commented

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.

commented

@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