13
0
geforkt von Mirrors/Paper

more improvements to expiring map stuff

Dieser Commit ist enthalten in:
Aikar 2018-09-16 03:21:52 -04:00
Ursprung a6792af72a
Commit bd4927d174

Datei anzeigen

@ -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..08d41e8cf0 100644
index 4006f5a69c..d64c143017 100644
--- a/src/main/java/net/minecraft/server/ExpiringMap.java
+++ b/src/main/java/net/minecraft/server/ExpiringMap.java
@@ -0,0 +0,0 @@ import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
@ -150,7 +150,7 @@ index 4006f5a69c..08d41e8cf0 100644
-
+ int ttlSize = this.ttl.size();
+ int thisSize = this.size();
+ if (ttlSize != thisSize) {
+ if (ttlSize < thisSize) {
+ if (!hasLeaked) { // log once
+ hasLeaked = true;
+ MinecraftServer.LOGGER.warn("WARNING: ExpiringMap desync (" + ttlSize + ":" + thisSize + ")- Memory leak risk! We will recover from this, but this means there is still a bug. Please do not open an issue about this. Mention it in Discord (we don't need everyone reporting the same thing)");
@ -170,6 +170,15 @@ index 4006f5a69c..08d41e8cf0 100644
}
protected boolean a(T var1) {
@@ -0,0 +0,0 @@ public class ExpiringMap<T> extends Long2ObjectOpenHashMap<T> {
}
public T get(long i) {
- this.a(i);
+ if (ttl.containsKey(i)) this.setAccess(i); // Paper
return (T)super.get(i);
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 80e8b023cf..70a609efcc 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java