Yatopia/patches/server/0031-Fix-LightEngineThreaded-memory-leak.patch
Simon Gardling 679a88af3f
Upstream (#447)
* Updated Upstream and Sidestream(s) (Paper/Airplane/Purpur/Empirecraft)

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.

Paper Changes:
4b78c0b80 [CI-SKIP] [Auto] Rebuild Patches
2d9ff13eb forced whitelist: use configuable kick message (fixes #5417) (#5418)
000cec2ab bug #5432 - post modern event even if legacy event is cancelled
6c83bc6e5 Remove from Map by key
857852c28 Make sure to remove correct TE during TE tick
f7b4abb25 [Auto] Updated Upstream (Bukkit/CraftBukkit)

Airplane Changes:
9a4bd85 Remove Multithreaded Tracker
1068498 Updated Upstream (Tuinity)

Purpur Changes:
083a86e [ci-skip] Update for Toothpick changes
8b9b214 Updated Upstream (Paper & Tuinity)

Empirecraft Changes:
6b5cffc2 Updated Paper

* Updated Upstream and Sidestream(s) (Airplane/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.

Airplane Changes:
3ed988c Use AIR library for configuration parsing

Purpur Changes:
9631959 Add 5 sec TPS to GUI (#260)
2a0a5e6 [ci-skip] Bump Toothpick Kotlin version
02b3444 Add back multithreaded entity tracker
43b4a2f Updated Upstream (Paper & Airplane)

* update gradle from 6.8.2 to 6.8.3

* fix build (hopefully)

* Updated Upstream and Sidestream(s) (Paper)

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.

Paper Changes:
211f8e041 Prevent light queue overfill when no players are online

* well that was dumb

* FINALLY it works

* Updated Upstream and Sidestream(s) (Empirecraft)

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.

Empirecraft Changes:
018fcff7 Updated Paper
2021-04-03 15:49:43 -04: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/level/LightEngineThreaded.java b/src/main/java/net/minecraft/server/level/LightEngineThreaded.java
index 381bd11075599d44e4c705a8e754769d29883d75..e36d11ffb3e66e6ce6f64d2e771661f8b29c95a8 100644
--- a/src/main/java/net/minecraft/server/level/LightEngineThreaded.java
+++ b/src/main/java/net/minecraft/server/level/LightEngineThreaded.java
@@ -123,6 +123,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/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java
index c97d29ef4b6d64a641d72ad754dab18932d185d5..8ea7ad63c0f091102f793b3c1f90b4121c4d74e0 100644
--- a/src/main/java/net/minecraft/server/level/WorldServer.java
+++ b/src/main/java/net/minecraft/server/level/WorldServer.java
@@ -2053,6 +2053,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) {