Starlight (NeoForge)

Starlight (NeoForge)

38.9k Downloads

Possible memory Leak?

PandaGGuy opened this issue ยท 6 comments

commented

Hey there, Been trying to trackdown a memory leak on my server while pregening. I think i tracked it down to starlight?

My test server setup:

  • JDK: Zulu 17
  • Java Arguments: -Xms1024M -Xmx5G -XX:MaxMetaspaceSize=512M -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:ShenandoahGCMode=iu -XX:ShenandoahGCHeuristics=compact -XX:ShenandoahUncommitDelay=20000 -XX:ShenandoahGarbageThreshold=10 -XX:ShenandoahAllocationThreshold=20 -XX:ShenandoahGuaranteedGCInterval=20000 -XX:ShenandoahUnloadClassesFrequency=60 -XX:MaxTenuringThreshold=1 -XX:+PerfDisableSharedMem -XX:+DisableExplicitGC -XX:+ParallelRefProcEnabled -XX:ParallelGCThreads=16 -XX:ConcGCThreads=4 -Dusing.aikars.flags=true
  • Base Mods:
    • fabric-api-0.46.4+1.18
    • lithium-fabric-mc1.18.1-0.7.7
    • sodium-fabric-mc1.18.1-0.4.0-alpha6+build.14
    • lazydfu-0.1.2
    • Chunky-1.2.164
    • spark-fabric

Test Procedure: Spun up two servers with same exact setup from above but one with starlight and one without. Ran chunky on both servers at the same time and took a heapdump after 10 minutes. Then let both servers sit idle for 5 minutes and took another heap dump. It looks like with starlight, java is struggling to clear out memory. This eventually causes the server to either hang/ crash due to out of memory/ or another occasional random crash while pregenning.

Example occasional crash while pregening w/ chunky on starlight server
image

It looks like once pregening is done, the server is fine and memory is able to clear out but while pregening it keeps building which causes issues when Pregening large modded worlds.

Please find heapdumps in dropbox folder below:
Speak Heap Dump Folder

Heads up, I do not have much dev experience in java. So if this was misidentified, please let me know!

commented

Can confirm I was having the same issue when generating with Chunky. After testing by uninstalling each mod one by one, the memory leak issues disappeared when I removed Starlight and restarted the pregeneration.

commented

I've run into the same thing, but only with chunky and not with other pregeneration mods. It's probably an issue on starlight's end.

commented

I can confirm Chunky with starlight 0.2 CPS without starlight 12 CPS.
ETA for some chunk generation with starlight 400 hours without starlight 16 hours.

commented

Interesting to see Starlight's SWMRNibbleArray[] appear as one of the larger heap users:
image

I'm not even pre-generating large areas (I'm just flying around in the world!) and it is retaining 148MB of heap space.

commented

Can confirm I am also having this issue

commented

The light engine can outpace the chunk system on these versions especially unfortunately.

The light arrays are only referenced by the LevelChunk, so the chunk system is not unloading chunks which is exactly what's happening in #88

Duplicate of #88