From e4a2177281f60b6d4f6a1cf0f3b65586a7ce3cf7 Mon Sep 17 00:00:00 2001 From: EvilSeph Date: Sat, 27 Aug 2011 00:49:35 -0400 Subject: [PATCH] Fixed memory leak Chunk Compression handling. Thanks Zeerix! --- .../org/bukkit/craftbukkit/ChunkCompressionThread.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/bukkit/craftbukkit/ChunkCompressionThread.java b/src/main/java/org/bukkit/craftbukkit/ChunkCompressionThread.java index 7490002f6d..9f9cd483e8 100644 --- a/src/main/java/org/bukkit/craftbukkit/ChunkCompressionThread.java +++ b/src/main/java/org/bukkit/craftbukkit/ChunkCompressionThread.java @@ -98,7 +98,12 @@ public final class ChunkCompressionThread implements Runnable { private void addToPlayerQueueSize(EntityPlayer player, int amount) { synchronized (queueSizePerPlayer) { Integer count = queueSizePerPlayer.get(player); - queueSizePerPlayer.put(player, (count == null ? 0 : count) + amount); + amount += (count == null) ? 0 : count; + if (amount == 0) { + queueSizePerPlayer.remove(player); + } else { + queueSizePerPlayer.put(player, amount); + } } }