Railcraft Reborn

Railcraft Reborn

3M Downloads

Memory Leak of Server Level

pietro-lopes opened this issue ยท 3 comments

commented

Is there an existing issue for this?

  • I have searched the existing issues

Description of the Bug

There is a memory leak here, even with keys bein a weak reference, ChargeNetworkImpl also holds a server, so it is never released.

private final Map<ServerLevel, ChargeNetworkImpl> networks = new MapMaker().weakKeys().makeMap();

Railcraft Reborn version

1.2.1

NeoForge/Forge version

21.1.21

Minecraft version

1.21.1

Minecraft server

No

To Reproduce

Join game and exit to Main menu

Expected behavior

No leak

Logs & Environment

No response

Screenshots & Video

image

commented

Hmm, I'm not an expert. What should I fix?
@Sm0keySa1m0n, can you take a look at it too?

commented

Yeah I can take a look.

commented

@Edivad99 That map can just be made into a fastutil Reference2ReferenceOpenHashMap and on level unload we need to remove the entry from the map.