Yatopia/patches/server/0033-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
Upstream (#365) * Updated Upstream and Sidestream(s) (Tuinity/AirplaneLite) 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: 06ce05b Fix broken chunk loading while under high block update stress AirplaneLite Changes: 1b05468 Always reset comment list adbefaa DEAR merged! (fix comment) 6e86873 Merge branch 'perf/activation-ranges' 12c221c Merge pull request #2 from Encode42/master 6095a90 Fix webhook build status 9ec74d9 Fix compile error b0adfa5 Hoglin support 829a3a2 Rebuild patches 553e5c4 Merge branch 'master' into perf/activation-ranges 95fb8ac Merge branch 'master' into perf/activation-ranges 4444971 ok 767e9e1 DEAR for piglins ce074ea Merge branch 'master' into perf/activation-ranges f12fce4 lower bound on activation prio d9962ce Add villager dynamic EAR ticking 10929cc Spelling 21d241c Merge branch 'master' into perf/activation-ranges 8f0039a Add configuration to activation ranges c758dfa Merge branch 'master' into perf/activation-ranges 17605f8 Raise lowest tick amount to 1s 1b604ca Fix Paper inactive tick, finish our range impl 72f27b7 Merge master dafa5a9 Merge branch 'master' into perf/activation-ranges 55c051f Tuning, still needs config 089d995 First pass at dynamic activation range * Updated Upstream and Sidestream(s) (Tuinity/AirplaneLite/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: 06ce05b Fix broken chunk loading while under high block update stress AirplaneLite Changes: 1b05468 Always reset comment list adbefaa DEAR merged! (fix comment) 6e86873 Merge branch 'perf/activation-ranges' 12c221c Merge pull request #2 from Encode42/master 6095a90 Fix webhook build status 9ec74d9 Fix compile error b0adfa5 Hoglin support 829a3a2 Rebuild patches 553e5c4 Merge branch 'master' into perf/activation-ranges 95fb8ac Merge branch 'master' into perf/activation-ranges 4444971 ok 767e9e1 DEAR for piglins ce074ea Merge branch 'master' into perf/activation-ranges f12fce4 lower bound on activation prio d9962ce Add villager dynamic EAR ticking 10929cc Spelling 21d241c Merge branch 'master' into perf/activation-ranges 8f0039a Add configuration to activation ranges c758dfa Merge branch 'master' into perf/activation-ranges 17605f8 Raise lowest tick amount to 1s 1b604ca Fix Paper inactive tick, finish our range impl 72f27b7 Merge master dafa5a9 Merge branch 'master' into perf/activation-ranges 55c051f Tuning, still needs config 089d995 First pass at dynamic activation range Purpur Changes: d72b228 Updated Upstream (Paper & Tuinity) * whoops * Updated Upstream and Sidestream(s) (Tuinity) 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: f8c0db4 Call queueUpdate() when scheduling chunk lighting * Updated Upstream and Sidestream(s) (Paper/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. Paper Changes: a98d389d1 Updated Upstream (CraftBukkit/Spigot) (#5119) Purpur Changes: f3644e1 Updated Upstream (Paper & Tuinity)
2021-01-27 17:13:19 +01:00
index 3c4c3e43b5b947f7332f2dd6d1f1dae4be7708ab..be4193a1c1f4d7bb62d42b786f33f636863a3dfb 100644
2020-09-10 20:35:41 +02:00
--- a/src/main/java/net/minecraft/server/LightEngineThreaded.java
+++ b/src/main/java/net/minecraft/server/LightEngineThreaded.java
@@ -110,6 +110,8 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable {
2020-09-10 20:35:41 +02:00
}
}
+ 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 be58626bdd1591758317c9c81cb3a6f2aecfc099..40e87f3043da14b1265fcdadde02bef3b261a9d1 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
@@ -1792,6 +1792,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) {