diff --git a/Spigot-Server-Patches/Fix-major-memory-leaks-in-ExpiringMap.patch b/Spigot-Server-Patches/Fix-major-memory-leaks-in-ExpiringMap.patch index 38d8f65cc..3a68122d1 100644 --- a/Spigot-Server-Patches/Fix-major-memory-leaks-in-ExpiringMap.patch +++ b/Spigot-Server-Patches/Fix-major-memory-leaks-in-ExpiringMap.patch @@ -11,13 +11,15 @@ 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..3b90f6e6c3 100644 +index 4006f5a69c..49021d29ee 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; import it.unimi.dsi.fastutil.longs.Long2LongMap.Entry; import it.unimi.dsi.fastutil.objects.ObjectIterator; import java.util.Map; ++import java.util.function.BiFunction; ++import java.util.function.Function; +import java.util.function.LongFunction; public class ExpiringMap extends Long2ObjectOpenHashMap { @@ -46,10 +48,77 @@ index 4006f5a69c..3b90f6e6c3 100644 + } + + @Override -+ public synchronized T computeIfAbsent(long l, LongFunction longFunction) { ++ public T compute(long l, BiFunction biFunction) { ++ setAccess(l); ++ return super.compute(l, biFunction); ++ } ++ ++ @Override ++ public T putIfAbsent(long l, T t) { ++ setAccess(l); ++ return super.putIfAbsent(l, t); ++ } ++ ++ @Override ++ public T computeIfPresent(long l, BiFunction biFunction) { ++ setAccess(l); ++ return super.computeIfPresent(l, biFunction); ++ } ++ ++ @Override ++ public T computeIfAbsent(long l, LongFunction longFunction) { + setAccess(l); + return super.computeIfAbsent(l, longFunction); + } ++ ++ @Override ++ public boolean replace(long l, T t, T v1) { ++ setAccess(l); ++ return super.replace(l, t, v1); ++ } ++ ++ @Override ++ public T replace(long l, T t) { ++ setAccess(l); ++ return super.replace(l, t); ++ } ++ ++ @Override ++ public T putIfAbsent(Long aLong, T t) { ++ setAccess(aLong); ++ return super.putIfAbsent(aLong, t); ++ } ++ ++ @Override ++ public boolean replace(Long aLong, T t, T v1) { ++ setAccess(aLong); ++ return super.replace(aLong, t, v1); ++ } ++ ++ @Override ++ public T replace(Long aLong, T t) { ++ setAccess(aLong); ++ return super.replace(aLong, t); ++ } ++ ++ @Override ++ public T computeIfAbsent(Long aLong, Function function) { ++ setAccess(aLong); ++ return super.computeIfAbsent(aLong, function); ++ } ++ ++ @Override ++ public T computeIfPresent(Long aLong, BiFunction biFunction) { ++ setAccess(aLong); ++ return super.computeIfPresent(aLong, biFunction); ++ } ++ ++ @Override ++ public T compute(Long aLong, BiFunction biFunction) { ++ setAccess(aLong); ++ return compute(aLong, biFunction); ++ } ++ + private boolean registered = false; + + // Break clean to its own method to be ticked