Foundational work for Future Memory usage improvements

This commit doesn't do much on its own, but adds a new Java Cleaner API
that lets us hook into Garbage Collector events to reclaim pooled objects and
return them to the pool.

Adds framework for Network Packets to know when a packet has finished dispatching
to get an idea when a packet is done sending to players.

Rewrites PooledObjects impl to properly respect max pool size and remove
almost all risk of contention.

Bumps the Paper Async Task Queue to use 2 threads, and properly shuts it down on shutdown.
This commit is contained in:
Aikar
2020-05-16 21:38:19 -04:00
parent bb4002d82e
commit 897dd2c840
30 changed files with 395 additions and 274 deletions

View File

@@ -177,7 +177,7 @@ index 0000000000000000000000000000000000000000..a85466bc7e0a8aa54b9eff14077fe6c9
+
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 1f2793967045d0bea59e62d9d9d39b03dbdef6c8..c502aedb8dc4e7a5d7ba9d16a200c20ca3d24cd4 100644
index 4a513aaea587414cf6abc1c136e52420d59688d8..d1667eba3398efecc8913c2778931030a90d6195 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1,6 +1,9 @@
@@ -190,7 +190,7 @@ index 1f2793967045d0bea59e62d9d9d39b03dbdef6c8..c502aedb8dc4e7a5d7ba9d16a200c20c
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.gson.JsonElement;
@@ -1092,7 +1095,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
@@ -1095,7 +1098,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas
if (i - this.Z >= 5000000000L) {
this.Z = i;
this.serverPing.setPlayerSample(new ServerPing.ServerPingPlayerSample(this.getMaxPlayers(), this.getPlayerCount()));