Closed pietro-lopes closed 4 months ago
Good catch! I fixed this for 1.20.6+. I can't port the fix back to 1.20.1, since it uses new neoforge features, tho from the image you've sent it shouldn't be that much of an issue.
@Mari023 for a quick backport fix, can you not change the Player field to a WeakReference? This should prevent the cyclical reference with your map that keeps Player loaded forever, as long as this Player object is maintained by another strong reference in the server.
@ViRb3 theoretically yes, but that would be quite annoying as the player can potentially be null at random places (tho arguably this is unlikely, since it only gets called from an existing player), and the current code doesn't deal with this possibility.
Also I don't really want to deal with the older versions unless absolutely necessary.
While
players
is a WeakMap, the value has an object that stores player so it prevents the GC to collect ServerPlayer, leaking when the player leaves the world and go to login screen.https://github.com/Mari023/AE2WirelessTerminalLibrary/blob/53cc53c68e97ae0da51dd65110a4e7a8a2996645/src/main/java/de/mari_023/ae2wtlib/wct/CraftingTerminalHandler.java#L25