Fix for unlucky memory leak
This commit is contained in:
@@ -145,6 +145,9 @@ public class GeometryManager {
|
||||
}
|
||||
|
||||
public void free() {
|
||||
while (!this.buildResults.isEmpty()) {
|
||||
this.buildResults.pop().free();
|
||||
}
|
||||
this.sectionMetaBuffer.free();
|
||||
this.geometryBuffer.free();
|
||||
}
|
||||
|
||||
@@ -57,6 +57,8 @@ public class RenderGenerationService {
|
||||
int buildFlags = task.flagSupplier.applyAsInt(section);
|
||||
if (buildFlags != 0) {
|
||||
var mesh = factory.generateMesh(section, buildFlags);
|
||||
section.release();
|
||||
|
||||
this.resultConsumer.accept(mesh.clone());
|
||||
|
||||
if (false) {
|
||||
@@ -67,10 +69,11 @@ public class RenderGenerationService {
|
||||
} else {
|
||||
mesh.free();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
section.release();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: Add a priority system, higher detail sections must always be updated before lower detail
|
||||
// e.g. priorities NONE->lvl0 and lvl1 -> lvl0 over lvl0 -> lvl1
|
||||
|
||||
Reference in New Issue
Block a user