mirror of
https://github.com/Minestom/Minestom.git
synced 2025-02-09 17:01:46 +01:00
Free memory when clearing palette
Signed-off-by: TheMode <themode@outlook.fr>
This commit is contained in:
parent
42dc264c93
commit
5e41b148a4
@ -49,8 +49,8 @@ public final class Section implements Writeable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void clear() {
|
public void clear() {
|
||||||
this.blockPalette = Palette.blocks();
|
this.blockPalette.fill(0);
|
||||||
this.biomePalette = Palette.biomes();
|
this.biomePalette.fill(0);
|
||||||
this.skyLight = new byte[0];
|
this.skyLight = new byte[0];
|
||||||
this.blockLight = new byte[0];
|
this.blockLight = new byte[0];
|
||||||
}
|
}
|
||||||
|
@ -154,15 +154,13 @@ final class PaletteImpl implements Palette, Cloneable {
|
|||||||
// Initialize the section
|
// Initialize the section
|
||||||
this.values = values = new long[(size + valuesPerLong - 1) / valuesPerLong];
|
this.values = values = new long[(size + valuesPerLong - 1) / valuesPerLong];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (placedAir) {
|
if (placedAir) {
|
||||||
Arrays.fill(values, 0);
|
this.values = new long[0];
|
||||||
this.count = 0;
|
this.count = 0;
|
||||||
} else {
|
} else {
|
||||||
long block = 0;
|
long block = 0;
|
||||||
for (int i = 0; i < valuesPerLong; i++) {
|
for (int i = 0; i < valuesPerLong; i++)
|
||||||
block |= (long) value << i * bitsPerEntry;
|
block |= (long) value << i * bitsPerEntry;
|
||||||
}
|
|
||||||
Arrays.fill(values, block);
|
Arrays.fill(values, block);
|
||||||
this.count = maxSize();
|
this.count = maxSize();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user