ModularMods / ModularWarfare

Gun mod & more - Minecraft 1.12.2
Other
39 stars 25 forks source link

PlayerSnapshot causing EntityPlayer instance leak #38

Open MrMks opened 2 years ago

MrMks commented 2 years ago

I checked the heapdump with memory analyze tool (by Eclipse), and it shows that there is a reference link to the instance of EntityPlayer. L$(2X8STK0`B 11F)V%PO{W

And then i checked the code, it seems that there is no methods to remove out-of-dated instances.

So, i think it must be a memory leak issue.

gameusefly commented 2 years ago

hey, i created a branche "fixplayersnapshot" on my fork (https://github.com/StateMC/ModularWarfare/tree/fixplayersnapshot) Please tell me if my fix work, then i will create a pull request to share the fix with everyone :)

Protoxy22 commented 2 years ago

Yes, you are both right. When a player leave the world, the PlayerData and the latest 20 hitbox snapshots stills exists on the hashmap.

@gameusefly If your commit is working in server-side/client-side feel free to make a pull request to solve the problem. Thanks

MrMks commented 2 years ago

@gameusefly I tested it in a forge only env, and it works well on server but doesn't on client.

After i leave the game, clientSideDatas are still there.

gameusefly commented 2 years ago

@MrMks i pushed a fix for that, feel free to test it :)

MrMks commented 2 years ago

@gameusefly ok, it works now.

gameusefly commented 2 years ago

The EntityPlayer leak is now fixed in the newest version of the stable branche