2018-01-22 01:19:57 +11:00
|
|
|
From e5d745509534995ab4ec5e1883efd7d427fbb646 Mon Sep 17 00:00:00 2001
|
2014-08-08 19:57:11 +10: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
|
2017-11-17 10:24:35 +11:00
|
|
|
index fe59b758f..936d6c640 100644
|
2014-08-08 19:57:11 +10:00
|
|
|
--- a/src/main/java/net/minecraft/server/PersistentCollection.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/PersistentCollection.java
|
2016-05-10 21:48:25 +10:00
|
|
|
@@ -19,7 +19,7 @@ public class PersistentCollection {
|
2014-08-08 19:57:11 +10:00
|
|
|
|
2016-06-09 11:43:56 +10:00
|
|
|
private final IDataManager b;
|
2015-02-28 11:36:22 +00:00
|
|
|
protected Map<String, PersistentBase> a = Maps.newHashMap();
|
2016-06-09 11:43:56 +10:00
|
|
|
- private final List<PersistentBase> c = Lists.newArrayList();
|
|
|
|
+ public final List<PersistentBase> c = Lists.newArrayList(); // Spigot
|
|
|
|
private final Map<String, Short> d = Maps.newHashMap();
|
2014-08-08 19:57:11 +10: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
|
2017-12-09 18:08:16 +11:00
|
|
|
index 83d49a296..30dff4f38 100644
|
2014-08-08 19:57:11 +10:00
|
|
|
--- a/src/main/java/net/minecraft/server/World.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/World.java
|
2017-12-09 18:08:16 +11:00
|
|
|
@@ -1112,6 +1112,23 @@ public abstract class World implements IBlockAccess {
|
2014-08-08 19:57:11 +10: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;
|
2016-11-17 12:41:12 +11:00
|
|
|
+ map.k.remove( entity );
|
|
|
|
+ for ( Iterator<WorldMap.WorldMapHumanTracker> iter = (Iterator<WorldMap.WorldMapHumanTracker>) map.i.iterator(); iter.hasNext(); )
|
2014-08-08 19:57:11 +10:00
|
|
|
+ {
|
|
|
|
+ if ( iter.next().trackee == entity )
|
|
|
|
+ {
|
|
|
|
+ iter.remove();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // Spigot end
|
|
|
|
this.everyoneSleeping();
|
2016-03-01 08:33:06 +11:00
|
|
|
this.c(entity);
|
2014-08-08 19:57:11 +10:00
|
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/WorldMap.java b/src/main/java/net/minecraft/server/WorldMap.java
|
2017-11-17 10:24:35 +11:00
|
|
|
index 61517f738..140286acb 100644
|
2014-08-08 19:57:11 +10:00
|
|
|
--- a/src/main/java/net/minecraft/server/WorldMap.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/WorldMap.java
|
2016-11-17 12:41:12 +11:00
|
|
|
@@ -25,7 +25,7 @@ public class WorldMap extends PersistentBase {
|
2014-08-08 19:57:11 +10:00
|
|
|
public byte scale;
|
|
|
|
public byte[] colors = new byte[16384];
|
2016-11-17 12:41:12 +11:00
|
|
|
public List<WorldMap.WorldMapHumanTracker> i = Lists.newArrayList();
|
|
|
|
- private final Map<EntityHuman, WorldMap.WorldMapHumanTracker> k = Maps.newHashMap();
|
|
|
|
+ public final Map<EntityHuman, WorldMap.WorldMapHumanTracker> k = Maps.newHashMap(); // Spigot private -> public
|
2015-02-28 11:36:22 +00:00
|
|
|
public Map<String, MapIcon> decorations = Maps.newLinkedHashMap();
|
|
|
|
|
2014-08-08 19:57:11 +10:00
|
|
|
// CraftBukkit start
|
|
|
|
--
|
2017-11-10 10:52:45 +11:00
|
|
|
2.14.1
|
2014-08-08 19:57:11 +10:00
|
|
|
|