Modified Sodium memory leak when rendering new chunks
lwsx opened this issue ยท 3 comments
Iris and Minecraft Version
iris-mc1.17-1.1.0 and sodium-fabric-mc1.17-0.3.0+IRIS1-rev.7491e3a for 1.17.1
Are you running Sodium along with Iris?
Yes
Operating System
Windows 10
What is your GPU?
RTX 3090
Java Version
Java 16.0.1
Reproduction Steps
- Join a Single Player or Multiplayer world
- Fly around in spectator mode
- As can be seen from task manager, for example, memory usage keeps on building up when rendering new terrain until the system runs out of memory and OpenGL crashes.
Crash Report file and latest.log
Didn't generate a crash report, here is a the end from the log file (this time it was a slightly different error, usually throws the "Nvidia OpenGL driver has run out of memory" error):
[22:48:58] [Server thread/INFO]: Saving chunks for level 'ServerLevel[Modpack Test]'/minecraft:overworld
[22:48:58] [Server thread/INFO]: Saving chunks for level 'ServerLevel[Modpack Test]'/minecraft:the_nether
[22:48:58] [Server thread/INFO]: Saving chunks for level 'ServerLevel[Modpack Test]'/minecraft:the_end
[22:49:02] [Chunk Render Task Executor #10/INFO]: [STDERR]: java.lang.OutOfMemoryError: Failed to allocate 695024 bytes
[22:49:02] [Chunk Render Task Executor #10/INFO]: [STDERR]: at net.minecraft.class_311.method_1596(class_311.java:13)
[22:49:02] [Chunk Render Task Executor #10/INFO]: [STDERR]: at me.jellysquid.mods.sodium.client.render.chunk.compile.ChunkBuildBuffers.createMesh(ChunkBuildBuffers.java:109)
[22:49:02] [Chunk Render Task Executor #10/INFO]: [STDERR]: at me.jellysquid.mods.sodium.client.render.chunk.tasks.ChunkRenderRebuildTask.performBuild(ChunkRenderRebuildTask.java:146)
[22:49:02] [Chunk Render Task Executor #10/INFO]: [STDERR]: at me.jellysquid.mods.sodium.client.render.chunk.compile.ChunkBuilder$WorkerRunnable.run(ChunkBuilder.java:207)
[22:49:02] [Chunk Render Task Executor #10/INFO]: [STDERR]: at java.base/java.lang.Thread.run(Thread.java:831)
[22:49:02] [Chunk Render Task Executor #9/INFO]: [STDERR]: java.lang.OutOfMemoryError: Failed to allocate 582912 bytes
[22:49:02] [Chunk Render Task Executor #9/INFO]: [STDERR]: at net.minecraft.class_311.method_1596(class_311.java:13)
[22:49:02] [Chunk Render Task Executor #9/INFO]: [STDERR]: at me.jellysquid.mods.sodium.client.render.chunk.compile.ChunkBuildBuffers.createMesh(ChunkBuildBuffers.java:109)
[22:49:02] [Chunk Render Task Executor #9/INFO]: [STDERR]: at me.jellysquid.mods.sodium.client.render.chunk.tasks.ChunkRenderRebuildTask.performBuild(ChunkRenderRebuildTask.java:146)
[22:49:02] [Chunk Render Task Executor #9/INFO]: [STDERR]: at me.jellysquid.mods.sodium.client.render.chunk.compile.ChunkBuilder$WorkerRunnable.run(ChunkBuilder.java:207)
[22:49:02] [Chunk Render Task Executor #9/INFO]: [STDERR]: at java.base/java.lang.Thread.run(Thread.java:831)
[22:49:02] [Chunk Render Task Executor #3/INFO]: [STDERR]: java.lang.OutOfMemoryError: Failed to allocate 26576 bytes
[22:49:02] [Chunk Render Task Executor #3/INFO]: [STDERR]: at net.minecraft.class_311.method_1596(class_311.java:13)
[22:49:02] [Chunk Render Task Executor #3/INFO]: [STDERR]: at me.jellysquid.mods.sodium.client.render.chunk.compile.ChunkBuildBuffers.createMesh(ChunkBuildBuffers.java:109)
[22:49:02] [Chunk Render Task Executor #3/INFO]: [STDERR]: at me.jellysquid.mods.sodium.client.render.chunk.tasks.ChunkRenderRebuildTask.performBuild(ChunkRenderRebuildTask.java:146)
[22:49:02] [Chunk Render Task Executor #3/INFO]: [STDERR]: at me.jellysquid.mods.sodium.client.render.chunk.compile.ChunkBuilder$WorkerRunnable.run(ChunkBuilder.java:207)
[22:49:02] [Chunk Render Task Executor #3/INFO]: [STDERR]: at java.base/java.lang.Thread.run(Thread.java:831)
Additional context
Since the leak is in the OpenGL side Minecraft JVM memory settings don't affect it (other than decreasing JVM memory will somewhat delay the crash).
I've tested this with no other mods than Iris, Sodium and Fabric API so I can say for certain that the problem for me is within the modified Sodium.
I've also tested Iris standalone (no issues) and regular Sodium (no issues).
From what I read, Sodium might've had a similar issue recently, which was supposedly patched in the latest version (and as said didn't cause any problems for me on the regular Sodium).
For me the crash usually occurs when the remaining memory drops under 1 GB.
Sorry for not having a better crash report or log, but the issue should be reproducable easily enough. Maybe set Minecraft JVM memory very high to induce the crash quicker?
This is not sodium's fault, rather it is Iris. We seemed to have fixed it in the dev as Niko stated. If you are on the discord, you're more than welcome to test it in the #testing channel.
This is not sodium's fault, rather it is Iris. We seemed to have fixed it in the dev as Niko stated. If you are on the discord, you're more than welcome to test it in the #testing channel.
Oh, didn't think to look into the Discord, my bad! The latest test build released today seems to work without issues so far, I'll be sure to notify of any issues there. Thank you!