From fe8fc6b90e9e16b62f8123f9309561b9262f9849 Mon Sep 17 00:00:00 2001 From: Mike Primm Date: Fri, 3 Aug 2012 01:19:10 -0500 Subject: Process entity ticks on worlds without players. Fixes BUKKIT-2031 Both the CB 1.3.1 code, and vanilla 1.3.1 code, have modified the behavior of entity tick processing in a way that can lead to disabling of entity cleanup. Specifically, the tickEntities() call in n.m.s.World, which processes both the entity cleanup (removing from the world entity list) and tile entity tick processing (furnaces and such) does not get called by n.m.s.MinecraftServer's q() method (which drives tick processing calls in general) when no players are on the given world. This causes a serious memory leak when automation processes, like dynmap mapping, load and unload chunks - as entities on unloaded chunks are only cleaned up during entity tick processing. It also will cause issues with any mods that use persistent chunk loading (that is, keeping chunks loaded so that tile entities will continue being processed), since such processing will no longer function without at least one player on the given world. In any case, the tickEntities() call should be called in the same fashion as under 1.2.x (each tick, independent of player population, as opposed to being suspended indefinitely when no players are on the given world). The specific memory leak observed, with removing the unloaded entites from the world, requires this call be made regularly (or, at least, whenever the entity unload queue (world.g) is not empty. Closes GH-832 --- src/main/java/net/minecraft/server/MinecraftServer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 8d07f855..bba95156 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -539,7 +539,7 @@ public abstract class MinecraftServer implements Runnable, IMojangStatistics, IC while (true) { if (!worldserver.updateLights()) { // this.methodProfiler.b(); // CraftBukkit - not in production code - if (!worldserver.players.isEmpty()) { + if (true || !worldserver.players.isEmpty()) { // CraftBukkit - this prevents entity cleanup, other issue on servers with no players worldserver.tickEntities(); } -- cgit v1.2.3