2015-07-27 14:20:54 +02:00
|
|
|
From 14ba0bac64f727b84aa4aab30e05677315b3bf9b Mon Sep 17 00:00:00 2001
|
2014-08-09 00:15:42 +02:00
|
|
|
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
|
2015-02-28 12:36:22 +01:00
|
|
|
index 4b8d548..451f481 100644
|
2014-08-09 00:15:42 +02:00
|
|
|
--- 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 {
|
|
|
|
|
2014-11-28 02:17:45 +01:00
|
|
|
private IDataManager b;
|
2015-02-28 12:36:22 +01:00
|
|
|
protected Map<String, PersistentBase> a = Maps.newHashMap();
|
|
|
|
- private List<PersistentBase> c = Lists.newArrayList();
|
|
|
|
+ public List<PersistentBase> c = Lists.newArrayList(); // Spigot
|
|
|
|
private Map<String, Short> d = Maps.newHashMap();
|
2014-08-09 00:15:42 +02:00
|
|
|
|
|
|
|
public PersistentCollection(IDataManager idatamanager) {
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
2015-07-27 14:20:54 +02:00
|
|
|
index 5a4e9e7..60fa9ca 100644
|
2014-08-09 00:15:42 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/World.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/World.java
|
2015-03-16 11:19:21 +01:00
|
|
|
@@ -1084,6 +1084,23 @@ public abstract class World implements IBlockAccess {
|
2014-08-09 00:15:42 +02:00
|
|
|
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 );
|
2015-02-28 12:36:22 +01:00
|
|
|
+ for ( Iterator<WorldMap.WorldMapHumanTracker> iter = (Iterator<WorldMap.WorldMapHumanTracker>) map.g.iterator(); iter.hasNext(); )
|
2014-08-09 00:15:42 +02:00
|
|
|
+ {
|
|
|
|
+ if ( iter.next().trackee == entity )
|
|
|
|
+ {
|
|
|
|
+ iter.remove();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // Spigot end
|
|
|
|
this.everyoneSleeping();
|
2014-11-28 02:17:45 +01:00
|
|
|
this.b(entity);
|
2014-08-09 00:15:42 +02:00
|
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/WorldMap.java b/src/main/java/net/minecraft/server/WorldMap.java
|
2015-02-28 12:36:22 +01:00
|
|
|
index 0e03164..9772760 100644
|
2014-08-09 00:15:42 +02:00
|
|
|
--- 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];
|
2015-02-28 12:36:22 +01:00
|
|
|
public List<WorldMap.WorldMapHumanTracker> g = Lists.newArrayList();
|
|
|
|
- private Map<EntityHuman, WorldMap.WorldMapHumanTracker> i = Maps.newHashMap();
|
|
|
|
+ public Map<EntityHuman, WorldMap.WorldMapHumanTracker> i = Maps.newHashMap(); // Spigot
|
|
|
|
public Map<String, MapIcon> decorations = Maps.newLinkedHashMap();
|
|
|
|
|
2014-08-09 00:15:42 +02:00
|
|
|
// CraftBukkit start
|
|
|
|
--
|
2015-05-09 22:23:26 +02:00
|
|
|
2.1.4
|
2014-08-09 00:15:42 +02:00
|
|
|
|