[SPIGOT-6383] Chunk Memory Leak Created: 01/Mar/21 Updated: 02/Mar/21 |
|
Status: | Open |
Project: | Spigot |
Component/s: | None |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | Bug | Priority: | Minor |
Reporter: | Parker Thornton | Assignee: | Unassigned |
Resolution: | Unresolved | Votes: | 0 |
Labels: | None | ||
Environment: |
Windows and Ubuntu, Java 11 and 15 |
Attachments: |
![]() ![]() |
Version: | git-Spigot-73fb609-ea050e6 (MC: 1.16.5) |
Guidelines Read: | Yes |
Description |
There is currently a memory leak with chunks if you don't save them even if you specify not to save in the unload event. This can be reproduced by disabling auto save of the world, loading some chunks and wait for them to unload. Attached is the source plugin to reproduce and an image of where the chunks are leaking. |
Comments |
Comment by blablubbabc [ 02/Mar/21 ] |
Yeah, I assume this applies to that plugin as well: Disabling auto save also disables the unload queue, which removes chunks from memory / from this updatingChunks map (http://prntscr.com/10ax1wb). |
Comment by Parker Thornton [ 02/Mar/21 ] |
Correct. But with a static map, I want data loss. As with setting the chunk not to save in the unload event, I would expect it not to queue for saving. |
Comment by md_5 [ 02/Mar/21 ] |
When you run /save-off for example in Vanilla chunks do not unload at all to prevent data loss. |
Comment by Parker Thornton [ 02/Mar/21 ] |
As you can see in the source plugin, I set it to not keep spawn in memory. This leak happens regardless of the chunk location. When saving is enabled, the chunks are released as expected. |
Comment by blablubbabc [ 02/Mar/21 ] |
Minecraft keeps chunks in a certain range around the spawn region and around players internally cached in memory. As long as this 'PlayerChunk' object is still inside the 'updatingChunks' map, it keeps the chunk cached if it is loaded at least once. The ChunkUnloadEvent in Bukkit only indicates that the chunk switched from state 'border', 'ticking', or 'entity_ticking' to state 'inaccessible' (i.e. this 'cached or not yet loaded' state). It does not actually indicate whether or not the chunk has been removed from memory (whether or not the server caches chunks is considered an internal implementation detail). How did you check whether or not saving makes a difference here? Without having tested this, I would expect this to make no difference in this regard. |