mirror of
https://github.com/PaperMC/Paper.git
synced 2025-03-13 19:28:03 +01:00
more improvements to expiring map stuff
This commit is contained in:
parent
a6792af72a
commit
bd4927d174
1 changed files with 11 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue