[Bug] Possible memory leak?
MetroByte opened this issue ยท 0 comments
Current Behaviour
Memory leak when open GUI, like CraftingTable, Anvil and anything else with ScreenHandler
s, also items with GUI, like BookEditScreen
. ScreenHandler
s and Screen
s are stacking in the Heap.
Expected Behaviour
Screen
s and ScreenHandler
s instances are removed by GC after GUIs closed.
Screenshots
Opened 20 times, got 20 instances. Without this mod I never have more than 1
Reproduction Steps
- Mods:
Fabric Api 0.87.0+1.20.1
,YetAnotherConfigLib 3.1.0+1.20
,Controlify 1.6.0+1.20
. Fabric Loader version0.14.22
- Create a new world or load one
- Place or take something with GUI, in my case this is Anvil, which extends
BlockEntity
- Open and close the placed Anvil GUI multiple times
- Take a Heap dump or attach a debugger (I used VisualVM 2.1.6 for a Heap Dump)
- Search for a screen class in
Class Filter
, for AnvilScreen it isclass_471
, ForgingScreenHandler isclass_4861
and AnvilScreenHandler isclass_1706
, they are leaking altogether - You can see a lot of class instances with references to
dev.isxander.controlify.screenop.compat.vanilla.AbstractContainerScreenProcessor
anddev.isxander.controlify.screenop.ScreenProcessor
Logs
No response
Mod Version
1.6.0+1.20
Controller
nothing
Bluetooth
- Yes
Operating System
Windows
ARM
- Yes
Additional Information
Maybe you should nullify references in Screens and ScreenHandlers in onClose
to make GC working? Just assuming, I don't know how does your mod working
No controllers at all, I just used Fabulously Optimised 5.3.0-beta4 which has this mod included. Disabling Controlify mod resolves this leak.
Just to make sure...
- I have made sure I am using the latest version of Controlify for the latest version of Minecraft.
- I have made sure there are no other issues describing the same problem on the issue tracker.