2017-03-15 20:51:00 +11:00
|
|
|
From 7c6dd6ade69d77f64cb90966d4da8e0314f723c3 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
|
2016-06-09 11:43:56 +10:00
|
|
|
index fe59b75..936d6c6 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-03-15 20:51:00 +11:00
|
|
|
index cfd3871..42aeede 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-03-15 20:51:00 +11:00
|
|
|
@@ -1109,6 +1109,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
|
2016-11-17 12:41:12 +11:00
|
|
|
index 2daedbe..fc5edab 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
|
|
|
|
--
|
2016-11-17 12:41:12 +11:00
|
|
|
2.9.3
|
2014-08-08 19:57:11 +10:00
|
|
|
|