Yatopia/patches/server/0033-Fix-LightEngineThreaded-memory-leak.patch
Simon Gardling f295cbb0ed
Updated Upstream and Sidestream(s) (Airplane) (#403)
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:
e71967b Spelling error
5ffdcdb Merge branch 'perf/reduce-allocs'
5f350d7 Minimize shouldDoLightning for inlining
271a374 Reduce memory allocations
2021-02-12 21:01:32 -05: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 001ac05cf26237eec8a77c476e678ff6d0840311..7b4935dd8c54f5fcb4f26b96c270d3e4102133a3 100644
--- 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 {
}
}
+ 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 17d728bf4f8393defd0a6f274d32f2ce926232a3..789e885eded90f1827332e0b4000c35b78ec2661 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -1818,6 +1818,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) {