Yatopia/patches/server/0044-Fix-LightEngineThreaded-memory-leak.patch
Ivan Pekov 830bb6b70d
Updated Upstream and Sidestream(s) (Tuinity/Purpur)
Upstream/An Sidestream has released updates that appears to apply and compile correctly
This update has NOT been tested by YatopiaMC and as with ANY update, please do your own testing.

Tuinity Changes:
f559558 Updated Upstream (Paper)

Purpur Changes:
1eaac71 Updated Upstream (Paper & Tuinity)
137523f Fix allowing color codes in signs
2020-11-08 18:59:56 +02:00

32 lines
1.6 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Ivan Pekov <ivan@mrivanplays.com>
Date: Thu, 10 Sep 2020 21:02:26 +0300
Subject: [PATCH] Fix LightEngineThreaded memory leak
diff --git a/src/main/java/net/minecraft/server/LightEngineThreaded.java b/src/main/java/net/minecraft/server/LightEngineThreaded.java
index 2f9c97dd4e1d705a87772d18c7ab4883a876af08..f3494ac1ad659352ca5595adf9e6919bdb4018d0 100644
--- a/src/main/java/net/minecraft/server/LightEngineThreaded.java
+++ b/src/main/java/net/minecraft/server/LightEngineThreaded.java
@@ -104,6 +104,8 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable {
}
}
+ public final void remove(long chunkId) { pendingTasks.removeIf(task -> task.chunkId == chunkId); queueUpdate(); } // Yatopia
+
public final boolean isEmpty() {
return this.size == 0 && this.pendingTasks.isEmpty();
}
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index bc46696d7e397684025affcc7b59028596df7f5e..735d40fede0710e9578cc60163e6c63c58ade9e5 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1913,6 +1913,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
}
// Paper end
+ chunkProvider.getLightEngine().queue.remove(chunk.getPos().pair()); // Yatopia - unregister from light queue
}
public void unregisterEntity(Entity entity) {