Just upgraded v1.7.9 world to 1.8.8. Increased memory allocation to min/max = 1.5G/2G out of 8 total. System is not maxed on memory. I have a farm/village where about 800 entities are active at any one time. Start game facing animals or villagers and just leave it. Memory usage gradually goes up to max with no other activity at all. Seems like GC isn't kicking in.
Sure, I'm not moving from the entities so why would it GC? But if it starts and only consumes 1.5G, why does it go up gradually? If it needs the memory wouldn't it allocate as soon as the entity objects instantiate?
The log shows "Memory: 130691400 bytes (124 MB) / 2121269248 bytes (2023 MB)" That's not right. The F3 mode shows memory usage gradually increasing in percentage up to 100% then lag starts. Could be that the memory usage was captured after crash for log as memory was being released. Windows also shows gradual memory usage.
Unusually high villager count is an experiment in breeding gone wild.
This is similar to when v1.7.10 came out and everyone complained about lag.
As memory us used the common "Can't keep up" messages display. That starts even at 20+% memory consumption. This is a fast system, I don't expect timing issues.
I started with lower memory but increased it when I was getting those messages and lagging - it just makes it take longer to lag.
Reducing view distance to 5 doesn't help. Moving into the nether doesn't help, memory pegs at max and stays there.
Moving from the high population area to an area with less than 100 entities does not help. Memory usage continues to go up. That might be due to simple chunk loading but that doesn't seem right when I'm underground and can't see the chunks anyway.
I can probably avoid this problem by reducing the population or moving to a different area. But is that really the right answer? Do we expect this given the data? If not, I have a 100% reproducible environment here that I'll be happy to share with Support.
Sorry if this is a duplicate report, I looked, didn't see anything recent that looked exactly like this.
Attachments
Comments 4
With JVM switches -Xms1500M -Xmx2G, I thought that's where the min/max is set. For old/new objects there's
-Xmn250M. The F3 showed progressive usage from about 20% with flickering changes of +2/-1, through 30%, 40%...100%. I got the log at about 95%. Which part of that would be 124MB?
I originally started at max 1GB and watched this pattern. Increased to 2 with same result, filed this ticket.
Yes: I increased max memory to 4GB with the same results: Entities at E: 10/530. I just sat in one spot, did absolutely nothing, and watched memory increase until eventually the game froze and returned 'Exception in thread "File IO Thread" java.lang.OutOfMemoryError: Java heap space'.
On restart I left the populated area, found an area with about 35 entities. With normal playing for about an hour usage increased into the 80% range. After leaving it sit with no activity it did drop to about 70% (2.8/4GB). Resuming normal activity with new cave on a newly discovered island, memory again increased over a period of about an hour until the game stopped responding.
On exit/resume I was able to play with memory not going above 80% - as expected it follows a pattern, going up to about 80 and then dropping back to 75 (3-3.5/4GB). So at this point the game is playable as long as I don't trip on whatever it is that causes the memory leak.
Yes: It does take longer to consume 4GB than 2, probably about twice as long.
May or may not be related - memory is not released on "Save and Exit Game" to exit a world - so going back into the game it's still pegged at 99%. Memory is only released on a full "Quit Game".
I'll be happy to load a debug version if you have logging which might help to trace the life-cycle of entities and other objects. Thanks.
Adding info: I experienced the described lag in a village. I was able to sit in that village with hundreds of villagers for a couple hours, and memory follows the well-behaved pattern of moving between 65% and 80% usage. I moved about 10 blocks away, and memory slowly rose to 99%/4GB. The sitting location now was not the same as the one described earlier. It's possible that I crossed into another chunk and/or came within range of a farm that's another couple chunks away, and that's what triggered the memory consumption. My view is currently 5 chunks and that's about the right range to the far with a lot of mobs.
I'll experiment with increasing/decreasing the chunk range and watching mob counts.
I guess my question is: Shouldn't we expect that at a point there is some kind of handling to flush out entities or distant chunks in order to keep enough memory available? Or is it defined behaviour that memory consumption will increase until it hits the limit and then we should expect to see lag? If I'm really asking the game to utilize all of the memory then I can't consider this a bug. But I'd hope that the game is smart enough to do garbage collection and other entity management to avoid simply running out of resources.
Thanks.
The log is quite right, it shows
means
and
Max
==Total
meanx Lag.Did you try to assign more than 2 GB ? Does it take longer for the memory to be exhausted or is there somewhere a limit of allocation ?