13
0
geforkt von Mirrors/Paper

Allow server startup for those poor people running <1G Xmx

Clamp logic for poolsize so we dont pass zero
Dieser Commit ist enthalten in:
Spottedleaf 2020-05-16 21:06:19 -07:00 committet von Aikar
Ursprung 3c9b65ef9d
Commit df43f82838
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 401ADFC9891FAAFE
2 geänderte Dateien mit 5 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -81,7 +81,7 @@ index 034244c2465b9999c6fba63ab2310becef51b887..a964647d1464d33c69b860cce44d918a
@Override
diff --git a/src/main/java/net/minecraft/server/NibbleArray.java b/src/main/java/net/minecraft/server/NibbleArray.java
index 996c8326387b5a7fe62db6a76e000144565cb85b..af32197dc82e3ebf32ff2ced954f7b4fe3ec9e21 100644
index 996c8326387b5a7fe62db6a76e000144565cb85b..1fcb1bdab28f79320aef50a9bbb2fbee8c7a2964 100644
--- a/src/main/java/net/minecraft/server/NibbleArray.java
+++ b/src/main/java/net/minecraft/server/NibbleArray.java
@@ -1,16 +1,50 @@
@ -97,7 +97,7 @@ index 996c8326387b5a7fe62db6a76e000144565cb85b..af32197dc82e3ebf32ff2ced954f7b4f
+ // 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[]> BYTE_2048 = new PooledObjects<>(() -> new byte[2048], maxPoolSize, 8);
+ public static void releaseBytes(byte[] bytes) {
+ if (bytes != null && bytes != EMPTY_NIBBLE && bytes.length == 2048) {

Datei anzeigen

@ -37,10 +37,10 @@ index b7b06e082e59f8518be2036637385c7710d524ea..71da9f00b8a969e84414066fb1852cec
return chunksection == Chunk.a || chunksection.c();
}
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index 263cc1e0a476797a73c37724326feec37f114ecf..018ef2c516dbf1997cedc378ed3b42cdaeab5a7d 100644
index af6d28a99adc94ae425520d7f6c125bb03654212..f11ec68a111dae31d0389a2bd09cb0bf7a9b88e3 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -376,7 +376,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -379,7 +379,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
player.needsChunkCenterUpdate = false;
player.playerConnection.sendPacket(new PacketPlayOutViewCentre(currPosX, currPosZ));
}
@ -49,7 +49,7 @@ index 263cc1e0a476797a73c37724326feec37f114ecf..018ef2c516dbf1997cedc378ed3b42cd
},
(EntityPlayer player, int rangeX, int rangeZ, int currPosX, int currPosZ, int prevPosX, int prevPosZ,
com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<EntityPlayer> newState) -> {
@@ -1955,12 +1955,112 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -1944,12 +1944,112 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
}