Note
The following is based on a decompiled version of Minecraft 1.9 using MCP 9.24 beta.
This has very likely only an effect on the title screen.
The bug
When you switch to title screen the garbage collection cannot collect everything from the world you had open before because Minecraft.pointedEntity
still references it.
To reproduce, simply quit to the title screen while looking at an entity. The field will not be set, and a WorldClient instance will be leaked.
This happens because the field is not set to null on the world changing, and EntityRenderer.getMouseOver
only sets it to null when there is a render view entity (and a world to render).
To reproduce
This uses the 1.18.1 symbol map.
First, locate
net.minecraft.client.Minecraft
(for 1.18.1, this isdxo
),crosshairPickEntity
(u
), andvoid runTick(boolean)
(f
).In the Minecraft launcher, add
-agentlib:jdwp=transport=dt_shmem,address=mc,server=y,suspend=n
to the JVM arguments.Run Minecraft, and open a world.
Put an entity in a location where it won't escape or move away from the cursor.
In a separate command-prompt window, run
jdb -attach mc
. This should attachjdb
to the Minecraft process.While looking at the entity, run the following in JDB:
stop in dxo.f(boolean)
(at which point the game should immediately freeze), followed byprint u
, (which should output the entity you were looking at), followed byclear dxo.f(boolean)
, followed byresume
(which should resume the game).In the game, pause, and then save and quit.
In JDB, again run the commands
stop in dxo.f(boolean)
,print u
,dxo.f(boolean)
, andresume
.The print command will still output the entity, even though the world should have unloaded; this indicates that memory has leaked to the title screen. (The expected output would instead be
null
).
Comments 2
The commandListener
issue was reported by someone else as MC-128561, and has actually already been fixed in 17w45a. The pointedEntity
issue still seems to be present, currently testing. I've edited this issue to only focus on that.
Is this still an issue in the latest snapshot 16w44a? If so please update the affected versions.
This is an automated comment on any open or reopened issue with out-of-date affected versions.