-
Bug
-
Resolution: Fixed
-
1.16.5, 1.17 Pre-release 1, 1.17, 1.18 Release Candidate 1, 1.18.1, 22w03a
-
Plausible
-
Performance
-
Normal
-
Platform
com.mojang.blaze3d.platform.TextureUtil#readResource(inputStream) leads to memory leakage problem.
This method throws IOException. However, if it throws, this method won't return the native pointer so you can't free the memory via MemoryUtil.memFree(). For example, #readResourceAsString finally block, the ByteBuffer is null if an IOException is catched. This will take up more and more memory along with the game.
To solve this, add a catch block inside #readResource, free the memory first, and then throw the catched exception.
... ByteBuffer byteBuffer2 = null; try { // reading ... } catch (Throwable t) { MemoryUtil.memFree(byteBuffer2); throw t; } return byteBuffer2;
- relates to
-
MC-257522 Memory indicator in debug screen could be wrong
- Resolved