Krypton

Krypton

22M Downloads

Client side memory leak with Direct Buffers

aria1th opened this issue ยท 6 comments

commented

I checked this with MemoryMXBean Direct pool size check.
Krypton does not release direct buffers in client side.
It happens when BlockEntityData is fully sent to client, which is usually non-vanilla behavior.
Direct Buffer Pool will increase size until it reaches memory limit, and OutOfMemory occurs, directly or indirectly if other mods are using direct memory allocation.

commented

Without a reproducer case I will not be able to take action. I am skeptical that this is a bug in Krypton.

commented
without.mp4
with.mp4

it eats 4MB of buffer every 3 seconds with krypton. The only difference is krypton...
Also its directbuffer pool size is from IRIS
https://github.com/IrisShaders/Iris/blob/1.18/src/main/java/net/coderbot/iris/mixin/MixinDebugScreenOverlay.java

commented

Well, Krypton sets a lower size for Netty buffer areas - 4MiB instead of the default 16MiB. This by itself explains the allocations being exactly 4MiB. The evidence you've provided means nothing except for the mod working as intended - it doesn't even necessarily show a memory leak.

I'm happy to further debug this issue, but the evidence you've provided me doesn't mean anything.

commented

sadly it accumulates over and over... until it reaches 32GB and more and crash...
2022-03-01_21 33 23
I'll check if setting ResourceLeakDetector.Level.ADVANCED solves this
Edit : No it does not.

commented

Managed to reproduce. As it turns out, Minecraft disables the Netty resource leak detector early in initialization and you need to use a mixin to make it not do that. I've fixed this and it identified the leak straight away. Working on a fix.

commented

Resolved in bcde156, will release 0.1.8 with the fix.