Paper/Spigot-Server-Patches/0336-Use-more-reasonable-thread-count-default-for-bootstr.patch
Spottedleaf 89a1469d3f Resolve memory leak involving TileEntities
Their chunk is set to null before removal, so we kept them around.
2019-05-14 17:19:58 -05:00

23 lines
912 B
Diff

From d9a13a84b740aab1f61ec78a2c2ae1bc18a670b6 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 23 Oct 2018 23:14:38 -0400
Subject: [PATCH] Use more reasonable thread count default for bootstrap
diff --git a/src/main/java/net/minecraft/server/SystemUtils.java b/src/main/java/net/minecraft/server/SystemUtils.java
index 5fae5a1233..6bc576f10f 100644
--- a/src/main/java/net/minecraft/server/SystemUtils.java
+++ b/src/main/java/net/minecraft/server/SystemUtils.java
@@ -66,7 +66,7 @@ public class SystemUtils {
}
private static ExecutorService k() {
- int i = MathHelper.clamp(Runtime.getRuntime().availableProcessors() - 1, 1, 7);
+ int i = Math.min(6, Math.max(Runtime.getRuntime().availableProcessors() - 2, 2)); // Paper - use more reasonable default - 2 is hard minimum to avoid using unlimited threads
Object object;
if (i <= 0) {
--
2.21.0