aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/unapplied/server/0080-Sanitise-RegionFileCache-and-make-configurable.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/unapplied/server/0080-Sanitise-RegionFileCache-and-make-configurable.patch')
-rw-r--r--patches/unapplied/server/0080-Sanitise-RegionFileCache-and-make-configurable.patch25
1 files changed, 25 insertions, 0 deletions
diff --git a/patches/unapplied/server/0080-Sanitise-RegionFileCache-and-make-configurable.patch b/patches/unapplied/server/0080-Sanitise-RegionFileCache-and-make-configurable.patch
new file mode 100644
index 0000000000..c8504969b8
--- /dev/null
+++ b/patches/unapplied/server/0080-Sanitise-RegionFileCache-and-make-configurable.patch
@@ -0,0 +1,25 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Antony Riley <[email protected]>
+Date: Tue, 29 Mar 2016 08:22:55 +0300
+Subject: [PATCH] Sanitise RegionFileCache and make configurable
+
+RegionFileCache prior to this patch would close every single open region
+file upon reaching a size of 256.
+This patch modifies that behaviour so it closes the the least recently
+used RegionFile.
+The implementation uses a LinkedHashMap as an LRU cache (modified from HashMap).
+The maximum size of the RegionFileCache is also made configurable.
+
+diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+index 40f2f4d052add3b4270d29c843e49fb621e1bc8d..54803d561d98b0d3fd8aa2060a7a184a00dd9da6 100644
+--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
++++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java
+@@ -39,7 +39,7 @@ public final class RegionFileStorage implements AutoCloseable {
+ if (regionfile != null) {
+ return regionfile;
+ } else {
+- if (this.regionCache.size() >= 256) {
++ if (this.regionCache.size() >= io.papermc.paper.configuration.GlobalConfiguration.get().misc.regionFileCacheSize) { // Paper - Sanitise RegionFileCache and make configurable
+ ((RegionFile) this.regionCache.removeLast()).close();
+ }
+