package me.nallar.patched;

import net.minecraft.network.TcpConnection;
import net.minecraft.server.ThreadMinecraftServer;

public abstract class PatchTcpReaderThread extends ThreadMinecraftServer {
	final TcpConnection tcpConnection;

	public PatchTcpReaderThread(TcpConnection tcpConnection, String name) {
		super(null, name);
		this.tcpConnection = tcpConnection;
	}

	@Override
	public void run() {
		TcpConnection.field_74471_a.getAndIncrement();

		try {
			while (tcpConnection.isRunning()) {
				while (true) {
					if (!tcpConnection.readNetworkPacket()) {
						try {
							sleep(2L);
						} catch (InterruptedException ignored) {
						}
					}
				}
			}
		} finally {
			TcpConnection.field_74471_a.getAndDecrement();
		}
	}
}

@@ -119,16 +119,58 @@
 Server;%0D
+%0Aimport net.minecraft.util.AxisAlignedBB;%0D
 %0A%0D%0Apubli
@@ -619,24 +619,72 @@
 acket()) %7B%0D%0A
+%09%09%09%09%09%09AxisAlignedBB.getAABBPool().cleanPool();%0D%0A
 %09%09%09%09%09%09try %7B%0D

Fix memory leak due to TcpReaderThread AABB pools never being cleared. If you are on build 740 or later it is recommended to update to the latest build