Carpet

Carpet

2M Downloads

Server instance is leaked after specific usages of `destroy()`

altrisi opened this issue ยท 3 comments

commented

Currently, we use a dummy entity for some destroy() operations. That one is created with the overworld at the time of first invocation, and cached so there's no need to create it at each usage.

However, it is also never freed, and therefore after changing singleplayer worlds, it is still reachable, leaking the overworld, that references (and leaks) the server. It is unknown if reusing it in a different world causes further issues.

Quick look at the game's code, it seems the dummy entity may not be needed anymore, given the LootContext builder it gets passed to takes it as optional parameter that seems to handle null.

I've done no testing yet on this last point though, and don't know if it may be needed for some tool interaction or something.

commented

Yeah, this is poorly annotated on the vanilla side.

commented

correction - see note about snow layers - its broken without a dummy entity

commented

And you literally can set the level to null, even if it shouldn't and everything works. Will change that