PaperSpigot-Parent/CraftBukkit-Patches/0149-Plug-WorldMap-Memory-Leak.patch
Zach Brown 19972e09b8 Update SpigotMC's patches
5a0150f586ed3eb15fe6f1f596d1a5a7d806f0f9 Fix ITEM_BREAK
e6a3911057bd94d8bd7021cbb4923fb84fb106d1 Upstream merge
d1cdcf8d4c3639f956474f02ed662517cffbe23e Remove old patch
068df64aeee368377e1673667bffc7a6dcf90554 Rebuild all patches
2014-11-30 16:16:48 -06:00

71 lines
2.7 KiB
Diff

From 1523633c4c42ce05c340947348f123726ad5dac7 Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
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..a4e5294 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) {
@@ -181,4 +181,4 @@ public class PersistentCollection {
return oshort.shortValue();
}
}
-}
+}
\ No newline at end of file
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index eb5b1db..762e469 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1081,6 +1081,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<WorldMapHumanTracker> iter = (Iterator<WorldMapHumanTracker>) 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