From 0ba94906ad0e0cab57238b1c8c962087f1975be2 Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 31 Mar 2016 19:08:27 -0400 Subject: [PATCH] Fix Massive Memory Leak Pathfinder objects are storing references to ChunkCache's, and never cleaning up. These ChunkCache's then leak other entity objects. Those entity objects then have leaks to their own chunk cache. A recursive problem.... Clean up the ChunkCache reference after it is done being used. --- .../0124-Fix-Massive-Memory-Leak.patch | 28 +++++++++++++++++++ importmcdev.sh | 1 + 2 files changed, 29 insertions(+) create mode 100644 Spigot-Server-Patches/0124-Fix-Massive-Memory-Leak.patch diff --git a/Spigot-Server-Patches/0124-Fix-Massive-Memory-Leak.patch b/Spigot-Server-Patches/0124-Fix-Massive-Memory-Leak.patch new file mode 100644 index 0000000000..671dee33f4 --- /dev/null +++ b/Spigot-Server-Patches/0124-Fix-Massive-Memory-Leak.patch @@ -0,0 +1,28 @@ +From a4e295c985a50926d5e66a184fc764f4aa301d6a Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Thu, 31 Mar 2016 19:06:47 -0400 +Subject: [PATCH] Fix Massive Memory Leak + +Pathfinder objects are storing references to ChunkCache's, and never cleaning up. + +These ChunkCache's then leak other entity objects. Those entity objects then have leaks to their +own chunk cache. A recursive problem.... + +Clean up the ChunkCache reference after it is done being used. + +diff --git a/src/main/java/net/minecraft/server/PathfinderAbstract.java b/src/main/java/net/minecraft/server/PathfinderAbstract.java +index d579577..40e5b4d 100644 +--- a/src/main/java/net/minecraft/server/PathfinderAbstract.java ++++ b/src/main/java/net/minecraft/server/PathfinderAbstract.java +@@ -23,7 +23,7 @@ public abstract class PathfinderAbstract { + this.f = MathHelper.d(entityinsentient.width + 1.0F); + } + +- public void a() {} ++ public void a() {this.a = (IBlockAccess) null;} // Paper - Fix massive memory leak. Intentionally casting to ensure compile error if obfuscation changes + + protected PathPoint a(int i, int j, int k) { + int l = PathPoint.b(i, j, k); +-- +2.8.0 + diff --git a/importmcdev.sh b/importmcdev.sh index 3a241fb58e..9900c11dc0 100755 --- a/importmcdev.sh +++ b/importmcdev.sh @@ -54,6 +54,7 @@ import PacketPlayInResourcePackStatus import PacketPlayOutPlayerListHeaderFooter import PacketPlayOutTitle import PacketPlayOutUpdateTime +import PathfinderAbstract import PathfinderGoalFloat import PersistentVillage import TileEntityEnderChest