Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2024-12-26 00:00:33 +01:00
Resolve memory leak
Dieser Commit ist enthalten in:
Ursprung
ba7333184b
Commit
2b76a5bc17
@ -181,10 +181,16 @@ public class BlockItemPackets1_13 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
handler(new PacketHandler() {
|
handler(new PacketHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
/*int x = wrapper.passthrough(Type.INT);
|
int chunkMinX = wrapper.passthrough(Type.INT) << 4;
|
||||||
int z = wrapper.passthrough(Type.INT;
|
int chunkMinZ = wrapper.passthrough(Type.INT) << 4;
|
||||||
BackwardsBlockStorage blockStorage = wrapper.user().get(BackwardsBlockStorage.class);*/
|
int chunkMaxX = chunkMinX + 15;
|
||||||
//TODO UNCACHE BLOCKSTORAGE ENTRIES - MEMORY LEAK!
|
int chunkMaxZ = chunkMinZ + 15;
|
||||||
|
BackwardsBlockStorage blockStorage = wrapper.user().get(BackwardsBlockStorage.class);
|
||||||
|
blockStorage.getBlocks().entrySet().removeIf(entry -> {
|
||||||
|
Position position = entry.getKey();
|
||||||
|
return position.getX() >= chunkMinX && position.getZ() >= chunkMinZ
|
||||||
|
&& position.getX() <= chunkMaxX && position.getZ() <= chunkMaxZ;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -87,4 +87,8 @@ public class BackwardsBlockStorage extends StoredObject {
|
|||||||
public void clear() {
|
public void clear() {
|
||||||
blocks.clear();
|
blocks.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Map<Position, Integer> getBlocks() {
|
||||||
|
return blocks;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren