mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-05 18:27:17 +01:00
Fix contextual map renderer memory leak (#11841)
This commit is contained in:
parent
b4051dbff7
commit
4b893907f6
1 changed files with 5 additions and 4 deletions
|
@ -5,6 +5,7 @@ import java.util.Arrays;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.WeakHashMap;
|
||||
import java.util.logging.Level;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
|
@ -19,9 +20,9 @@ import org.bukkit.map.MapView;
|
|||
|
||||
public final class CraftMapView implements MapView {
|
||||
|
||||
private final Map<CraftPlayer, RenderData> renderCache = new HashMap<CraftPlayer, RenderData>();
|
||||
private final List<MapRenderer> renderers = new ArrayList<MapRenderer>();
|
||||
private final Map<MapRenderer, Map<CraftPlayer, CraftMapCanvas>> canvases = new HashMap<MapRenderer, Map<CraftPlayer, CraftMapCanvas>>();
|
||||
private final Map<CraftPlayer, RenderData> renderCache = new WeakHashMap<>();
|
||||
private final List<MapRenderer> renderers = new ArrayList<>();
|
||||
private final Map<MapRenderer, Map<CraftPlayer, CraftMapCanvas>> canvases = new HashMap<>();
|
||||
protected final MapItemSavedData worldMap;
|
||||
|
||||
public CraftMapView(MapItemSavedData worldMap) {
|
||||
|
@ -99,7 +100,7 @@ public final class CraftMapView implements MapView {
|
|||
public void addRenderer(MapRenderer renderer) {
|
||||
if (!this.renderers.contains(renderer)) {
|
||||
this.renderers.add(renderer);
|
||||
this.canvases.put(renderer, new HashMap<CraftPlayer, CraftMapCanvas>());
|
||||
this.canvases.put(renderer, new WeakHashMap<>());
|
||||
renderer.initialize(this);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue