Affects Version/s: 1.15.2
Fix Version/s: 20w21a
In analyzing heap memory usage, it was noticed that long was a serious contender...
In tracing it back, it was found that BitSets used for Carving Masks were the heaviest user, stored as a reference from ProtoChunk, which was linked to the ChunkHolder.
The ChunkHolder is holding a ref from the status future cache.
This is due to the fact that during Chunk Saving, the carving masks are saved regardless of chunk status, so saving creates the 65k BitSets and saves them, even at statuses like StructureStart which we have TONS of....
Then when that ProtoChunk is loaded again, those 65k BitSets are loaded into memory and kept around in the cache even when that chunk isn't promoting to FULL.
Fix is pretty simple, don't write CarvingMasks unless they've actually been generated when saving.