When spawning and killing lots of mobs, memory usage will rise and will not go down even though all the mobs that were spawned were killed. Memory usage will stay high even when saving and exiting the world and loading another world.
What I expected to happen was...:
Memory usage wouldn't be so high
What actually happened was...:
Memory usage got so high that Minecraft started to freeze for small periods of time which then eventually caused Minecraft to run out of memory.
Steps to Reproduce:
It's easier to do this in a medium to large room with obsidian walls, floors and ceiling.
1. Spawn lots of skeletons
2. Spawn lots of witches
3. Have skeletons attack each other and witches attack each other by going into survival mode
4. Spawn creepers to kill the witches and skeletons
5. When amount of skeletons remaining gets to a low level, spawn more skeletons
6. When amount of witches remaining gets to a low level, spawn more witches
7. Keep repeating steps 4 to 6 until you notice the game starting to freeze for small periods of time every few frames or when the screen appears saying Minecraft ran out of memory
Attachments
Comments 5
That's
Memory: 279670624 bytes (266 MB) / 1033240576 bytes (985 MB) up to 1033240576 bytes (985 MB)
not that much.
How many mobs do you spawn ? Tens ? Hundrets ? Thousands ?
Maybe you'll need to start minecraft with more memory assigned to the JVM, for example:
minecraft.bat
java -Xmx2g -Xms512M -cp minecraft.exe net.minecraft.LauncherFrame
I don't call this a bug, this is just a limitation since every mob needs memory, and if you spawn more mobs than memory available -> You'll get an out of memory message.
That's exactly what I saw in the crash report but before I manually triggered a crash, Minecraft was telling me that it was using over 700MB which would slowly increase to over 90% memory usage. Then the game would freeze for some time before going back to 700MB memory usage which would then again slowly increase to over 90%.
Even after saving and exiting the current world and loading another one Minecraft was still telling me that it was using 700MB and I still got random freezes when memory usage was over 90%
I spawned around about 10000 to 20000 mobs but if I allow Minecraft to use 4GB of RAM, it reports itself using 2GB of RAM after all the mobs are gone. I didn't spawn all the mobs at once because that would cause the game to lag heavily. I will probably have to take a few screenshots showing the exact problem.
Please force a crash by pressing F3 + C for 10 seconds while ingame and attach the crash report here.