From 7b8c3623605cadad5dc6e0e365b9130edd0417a7 Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 8 Aug 2014 19:57:03 +1000 Subject: [PATCH] Plug WorldMap Memory Leak diff --git a/src/main/java/net/minecraft/server/PersistentCollection.java b/src/main/java/net/minecraft/server/PersistentCollection.java index 6bae818..5c36d3e 100644 --- a/src/main/java/net/minecraft/server/PersistentCollection.java +++ b/src/main/java/net/minecraft/server/PersistentCollection.java @@ -18,7 +18,7 @@ public class PersistentCollection { private IDataManager b; protected Map a = Maps.newHashMap(); - private List c = Lists.newArrayList(); + public List c = Lists.newArrayList(); // Spigot private Map d = Maps.newHashMap(); public PersistentCollection(IDataManager idatamanager) { diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index 1f44847..c50aa62 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -1083,6 +1083,23 @@ public abstract class World implements IBlockAccess { entity.die(); if (entity instanceof EntityHuman) { this.players.remove(entity); + // Spigot start + for ( Object o : worldMaps.c ) + { + if ( o instanceof WorldMap ) + { + WorldMap map = (WorldMap) o; + map.i.remove( entity ); + for ( Iterator iter = (Iterator) map.g.iterator(); iter.hasNext(); ) + { + if ( iter.next().trackee == entity ) + { + iter.remove(); + } + } + } + } + // Spigot end this.everyoneSleeping(); this.b(entity); } diff --git a/src/main/java/net/minecraft/server/WorldMap.java b/src/main/java/net/minecraft/server/WorldMap.java index 49826ae..36fcb15 100644 --- a/src/main/java/net/minecraft/server/WorldMap.java +++ b/src/main/java/net/minecraft/server/WorldMap.java @@ -22,7 +22,7 @@ public class WorldMap extends PersistentBase { public byte scale; public byte[] colors = new byte[16384]; public List g = Lists.newArrayList(); - private Map i = Maps.newHashMap(); + public Map i = Maps.newHashMap(); // Spigot public Map decorations = Maps.newLinkedHashMap(); // CraftBukkit start -- 2.1.0