Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-101233

Burned out redstone torch map causes memory leak


    • Confirmed
    • (Unassigned)


      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.

      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.

            fry [Mojang] Georgii Gavrichev
            marcono1234 Marcono1234
            11 Vote for this issue
            7 Start watching this issue