mirror of
https://hub.spigotmc.org/stash/scm/spigot/spigot.git
synced 2025-08-31 21:49:13 +00:00
63 lines
2.9 KiB
Diff
63 lines
2.9 KiB
Diff
From 3f54d8c7e9f913bb82e80ca110aa5b91b11c7665 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 855192af3..6b5600ba5 100644
|
|
--- a/src/main/java/net/minecraft/server/PersistentCollection.java
|
|
+++ b/src/main/java/net/minecraft/server/PersistentCollection.java
|
|
@@ -29,7 +29,7 @@ public class PersistentCollection {
|
|
private static final Logger b = LogManager.getLogger();
|
|
private final IDataManager c;
|
|
protected Map<String, PersistentBase> a = Maps.newHashMap();
|
|
- private final List<PersistentBase> d = Lists.newArrayList();
|
|
+ public final List<PersistentBase> d = Lists.newArrayList(); // Spigot
|
|
private final Object2IntMap<String> e = new Object2IntOpenHashMap();
|
|
|
|
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 9320d88c1..dfcafc6d4 100644
|
|
--- a/src/main/java/net/minecraft/server/World.java
|
|
+++ b/src/main/java/net/minecraft/server/World.java
|
|
@@ -979,6 +979,23 @@ public abstract class World implements GeneratorAccess, IIBlockAccess, AutoClose
|
|
entity.die();
|
|
if (entity instanceof EntityHuman) {
|
|
this.players.remove(entity);
|
|
+ // Spigot start
|
|
+ for ( Object o : worldMaps.d )
|
|
+ {
|
|
+ if ( o instanceof WorldMap )
|
|
+ {
|
|
+ WorldMap map = (WorldMap) o;
|
|
+ map.j.remove( entity );
|
|
+ for ( Iterator<WorldMap.WorldMapHumanTracker> iter = (Iterator<WorldMap.WorldMapHumanTracker>) map.h.iterator(); iter.hasNext(); )
|
|
+ {
|
|
+ if ( iter.next().trackee == entity )
|
|
+ {
|
|
+ iter.remove();
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ // Spigot end
|
|
this.everyoneSleeping();
|
|
this.c(entity);
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/WorldMap.java b/src/main/java/net/minecraft/server/WorldMap.java
|
|
index 51fa1b1b9..445a016b7 100644
|
|
--- a/src/main/java/net/minecraft/server/WorldMap.java
|
|
+++ b/src/main/java/net/minecraft/server/WorldMap.java
|
|
@@ -26,7 +26,7 @@ public class WorldMap extends PersistentBase {
|
|
public byte scale;
|
|
public byte[] colors = new byte[16384];
|
|
public List<WorldMap.WorldMapHumanTracker> h = Lists.newArrayList();
|
|
- private final Map<EntityHuman, WorldMap.WorldMapHumanTracker> j = Maps.newHashMap();
|
|
+ public final Map<EntityHuman, WorldMap.WorldMapHumanTracker> j = Maps.newHashMap(); // Spigot private -> public
|
|
private final Map<String, MapIconBanner> k = Maps.newHashMap();
|
|
public Map<String, MapIcon> decorations = Maps.newLinkedHashMap();
|
|
|
|
--
|
|
2.17.1
|
|
|