From aba7b389ab2bf988046c72c2cfccbde9bac2da40 Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Sat, 16 May 2020 21:06:19 -0700 Subject: [PATCH] Allow server startup for those poor people running <1G Xmx Clamp logic for poolsize so we dont pass zero --- .../Optimize-NibbleArray-to-use-pooled-buffers.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Spigot-Server-Patches/Optimize-NibbleArray-to-use-pooled-buffers.patch b/Spigot-Server-Patches/Optimize-NibbleArray-to-use-pooled-buffers.patch index d402639e22..f1c051ce44 100644 --- a/Spigot-Server-Patches/Optimize-NibbleArray-to-use-pooled-buffers.patch +++ b/Spigot-Server-Patches/Optimize-NibbleArray-to-use-pooled-buffers.patch @@ -97,7 +97,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start + public static byte[] EMPTY_NIBBLE = new byte[2048]; + private static final int nibbleBucketSizeMultiplier = Integer.getInteger("Paper.nibbleBucketSize", 3072); -+ private static final int maxPoolSize = Integer.getInteger("Paper.maxNibblePoolSize", (int) Math.min(6, Runtime.getRuntime().maxMemory() / 1024 / 1024 / 1024) * (nibbleBucketSizeMultiplier * 8)); ++ private static final int maxPoolSize = Integer.getInteger("Paper.maxNibblePoolSize", (int) Math.min(6, Math.max(1, Runtime.getRuntime().maxMemory() / 1024 / 1024 / 1024)) * (nibbleBucketSizeMultiplier * 8)); + public static final PooledObjects BYTE_2048 = new PooledObjects<>(() -> new byte[2048], maxPoolSize, 8); + public static void releaseBytes(byte[] bytes) { + if (bytes != null && bytes != EMPTY_NIBBLE && bytes.length == 2048) {