mirror of
https://github.com/YatopiaMC/Yatopia.git
synced 2024-11-14 22:56:29 +01:00
d065d41c0e
Apparently caused issues we werent aware of. Unfortunately there's no way to improve it without blocking the main thread.
32 lines
1.6 KiB
Diff
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 fd0beefb900c064d3c35a3d2f79f5b7d9c1287bb..4d024a4849b7566c0faba131caab57b4ddf35e29 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 2df0162d70d4d60f05565d22cb4ef69b21f2d4bf..bf5ce30a08899279ab5d0ffe7d7448a2e939e84d 100644
|
|
--- a/src/main/java/net/minecraft/server/WorldServer.java
|
|
+++ b/src/main/java/net/minecraft/server/WorldServer.java
|
|
@@ -1786,6 +1786,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) {
|