WarzoneMC / tgm

Team Game Manager - Minecraft PVP Suite
https://warzone.network
40 stars 37 forks source link

Match world references not being garbage collected (memory leak) #774

Closed sowhatifimlazy closed 3 years ago

sowhatifimlazy commented 3 years ago

Describe the bug After a match has ended, it's world is unloaded but it's references hang around in memory (screenshots below) leaving a very high memory footprint and causing the server to constantly garbage collect, inherently causing lag.

Client version Not applicable.

To Reproduce Play a few matches, then take a heap dump and open it in your favorite profiler (I'm using YourKit in the screenshots below). You will see a net.minecraft.server.v1_16_R3.WorldServer instance just hanging around in memory for each match that was played.

Expected behavior Not applicable.

Screenshots 1

I've went ahead and verified that the extra net.minecraft.server.v1_16_R3.WorldServer instances are related to previous matches: 2 3 4

Server Software (Spigot/PaperSpigot): Tuinity

All testing was done on a fresh server with no extra plugins.

Additional context I've spoken to tank#1566 on the Discord about this issue, and he seems have confirmed this issue as well.

5

Atdit commented 3 years ago

No matter how many matches I play, I only get around 5-6 objects, with a total size of ~3MB. I tried going up to 20-30 matches, but without actual gameplay, just a /start 0, /end /cycle 0 etc.

sowhatifimlazy commented 3 years ago

No matter how many matches I play, I only get around 5-6 objects, with a total size of ~3MB. I tried going up to 20-30 matches, but without actual gameplay, just a /start 0, /end /cycle 0 etc.

Commit ae091f8 seems to have to have mostly fixed the issue.

I'm also only getting 4-5 objects sitting in memory after 300+ actual matches played, which is a massive improvement compared to what it was before.

I guess we can mark this as solved!