Mojira Archive
MC-101233

Burned out redstone torch map causes memory leak

Note

The following is based on a decompiled version of Minecraft 1.9 using MCP 9.24 beta.

The bug

The field net.minecraft.block.BlockRedstoneTorch.toggles is a map with Worlds (like Overworld, End and Nether) as key and a list of redstone torch states as value. The problem is that a world is never removed from this list, which means that all save files you load containing redstone torches that burned out have still a reference in this list and cannot be collected by the garbage collection.

In general it might be better to use a TileEntity to store this value. But I am not too familiar with what effect this would have on performance.

[Mod] Pokechu22: Alternatively, using a WeakHashMap would also solve this, as it would allow the World to be collected without having to do any extra work.

Fixed

Marcono1234

[Mojang] Georgii Gavrichev

2016-04-23, 11:28 PM

2019-04-17, 05:31 PM

2019-04-17, 05:31 PM

11

7

Confirmed

(Unassigned)

memory-leak, redstone_torch, world

Minecraft 1.9.2 - Minecraft 18w30bMinecraft 1.9.2, Minecraft 1.11.2, Minecraft 1.12.2, Minecraft 18w15a, Minecraft 1.13, Minecraft 18w30a, Minecraft 18w30b

Minecraft 1.14 Pre-Release 4