spigot/CraftBukkit-Patches/0096-Plug-WorldMap-Memory-Leak.patch

40 lines
1.6 KiB
Diff

From 49966149800703ee9ac576ebdf77a822b7fe0a74 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/World.java b/src/main/java/net/minecraft/server/World.java
index 5452a2575..2a7508128 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -958,6 +958,26 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
entity.die();
if (entity instanceof EntityHuman) {
this.players.remove(entity);
+ // Spigot start
+ for ( WorldPersistentData worldData : worldMaps.worldMap.values() )
+ {
+ for (Object o : worldData.data.values() )
+ {
+ if ( o instanceof WorldMap )
+ {
+ WorldMap map = (WorldMap) o;
+ map.humans.remove( (EntityHuman) 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);
}
--
2.19.1