Yatopia/patches/server/0046-Fix-LightEngineThreaded-memory-leak.patch

32 lines
1.6 KiB
Diff
Raw Normal View History

2020-09-10 20:35:41 +02:00
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 ceaa92400678aef3bf436279dd807e4b38609dda..d9bbac17c5767df638fc4464e9795d5c842c3056 100644
--- a/src/main/java/net/minecraft/server/LightEngineThreaded.java
+++ b/src/main/java/net/minecraft/server/LightEngineThreaded.java
@@ -114,6 +114,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
2020-09-11 08:03:00 +02:00
index 82a98a60d3ca06533fa3e6db53394fe6c6c77cb8..fd8aacc3a158093e524d2bc552a3c2fdc9135ecf 100644
2020-09-10 20:35:41 +02:00
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
2020-09-11 08:03:00 +02:00
@@ -1808,6 +1808,7 @@ public class WorldServer extends World implements GeneratorAccessSeed {
2020-09-10 20:35:41 +02:00
}
// Paper end
+ chunkProvider.getLightEngine().queue.remove(chunk.getPos().pair()); // Yatopia - unregister from light queue
}
public void unregisterEntity(Entity entity) {