Better Foliage

Better Foliage

35M Downloads

[1.16.5] `ChunkOverlayData$Companion#emptyOverlay` using up a large amount of memory

Cadiboo opened this issue ยท 3 comments

commented

I noticed that Minecraft was stalling a lot after installing BetterFoliage.
I looked at the game's memory usage and saw that it was going up to 100% then back down to 40% about once every second.
I sampled the game's memory usage using VisualVM and saw that it was allocating lots of Object[]s, I then profiled the memory usage and saw that the following code seems to be responsible.
Screen Shot 2021-06-14 at 4 22 57 pm
Screen Shot 2021-06-14 at 4 18 54 pm
Screen Shot 2021-06-14 at 4 34 28 pm

if (event.chunk.pos !in chunks.keys) chunks[event.chunk.pos] = ChunkOverlayData(layers)

fun emptyOverlay() = Array(16) { Array(16) { Array<Any?>(256) { UNCALCULATED }}}

commented

Same as #346, see explanation there.

I'm treating this one as critical.

commented

Oops sorry, should have looked at the other issues first

commented

I have encountered what appears to be the same issue. Lag spikes for seemingly no reason whenever a chunk (new or otherwise) is loaded. I have pretty much been forced to remove the mod from my mod folder.