FixMem
This commit is contained in:
@@ -43,6 +43,10 @@ public class ContextSelectionSystem {
|
|||||||
|
|
||||||
config.storageConfig = compression;
|
config.storageConfig = compression;
|
||||||
DEFAULT_STORAGE_CONFIG = Serialization.GSON.toJson(config);
|
DEFAULT_STORAGE_CONFIG = Serialization.GSON.toJson(config);
|
||||||
|
|
||||||
|
if (Serialization.GSON.fromJson(DEFAULT_STORAGE_CONFIG, WorldConfig.class) == null) {
|
||||||
|
throw new IllegalStateException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Selection {
|
public static class Selection {
|
||||||
|
|||||||
@@ -52,7 +52,9 @@ public class MemoryStorageBackend extends StorageBackend {
|
|||||||
public void setSectionData(long key, ByteBuffer data) {
|
public void setSectionData(long key, ByteBuffer data) {
|
||||||
var map = this.getMap(key);
|
var map = this.getMap(key);
|
||||||
synchronized (map) {
|
synchronized (map) {
|
||||||
var old = map.put(key, data);
|
var cpy = MemoryUtil.memAlloc(data.remaining());
|
||||||
|
MemoryUtil.memCopy(data, cpy);
|
||||||
|
var old = map.put(key, cpy);
|
||||||
if (old != null) {
|
if (old != null) {
|
||||||
MemoryUtil.memFree(old);
|
MemoryUtil.memFree(old);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user