3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-11-17 05:20:14 +01:00

Set Netty pooled buffer size to 2MiB

Dieser Commit ist enthalten in:
Andrew Steinborn 2019-01-19 02:48:11 -05:00
Ursprung 0b0fa0a352
Commit e2f93c6ac6

Datei anzeigen

@ -12,6 +12,17 @@ public class Velocity {
// We use BufferedImage for favicons, and on macOS this puts the Java application in the dock.
// How inconvenient. Force AWT to work with its head chopped off.
System.setProperty("java.awt.headless", "true");
// By default, Netty allocates 16MiB arenas for the PooledByteBufAllocator. This is too much
// memory for Minecraft, which imposes a maximum packet size of 2MiB! We'll use 2MiB as a more
// sane default.
//
// Note: io.netty.allocator.pageSize << io.netty.allocator.maxOrder is the formula used to
// compute the chunk size. We lower maxOrder from its default of 11 to 8. (We also use a null
// check, so that the user is free to choose another setting if need be.)
if (System.getProperty("io.netty.allocator.maxOrder") == null) {
System.setProperty("io.netty.allocator.maxOrder", "8");
}
}
/**