3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-15 11:00:06 +01:00

fix bug in last bug fix, recursion!

Dieser Commit ist enthalten in:
Aikar 2018-09-16 00:26:32 -04:00
Ursprung 2c3e7e48fc
Commit b6760850b8
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 401ADFC9891FAAFE

Datei anzeigen

@ -1,4 +1,4 @@
From c9297fde1beff53e303bb09caf0bb4b20c6792ce Mon Sep 17 00:00:00 2001
From 9a08afb634666123c7181b6d7b26052c4b423588 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 16 Sep 2018 00:00:16 -0400
Subject: [PATCH] Fix major memory leaks in ExpiringMap
@ -11,7 +11,7 @@ not run on every manipulation, and instead to run clean
once per tick per expiring map.
diff --git a/src/main/java/net/minecraft/server/ExpiringMap.java b/src/main/java/net/minecraft/server/ExpiringMap.java
index 4006f5a69c..5345b97241 100644
index 4006f5a69c..3b90f6e6c3 100644
--- a/src/main/java/net/minecraft/server/ExpiringMap.java
+++ b/src/main/java/net/minecraft/server/ExpiringMap.java
@@ -6,25 +6,44 @@ import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
@ -72,9 +72,9 @@ index 4006f5a69c..5345b97241 100644
}
}
-
+ if (this.ttl.size() != this.size) {
+ if (this.ttl.size() != this.size()) {
+ MinecraftServer.LOGGER.error("WARNING: ExpiringMap desync - Memory leak risk!");
+ for (Entry<T> entry : this.entries) {
+ for (Entry<T> entry : this.long2ObjectEntrySet()) {
+ ttl.putIfAbsent(entry.getLongKey(), now);
+ }
+ }