Decrease cache size if max memory is small
This commit is contained in:
@@ -52,10 +52,15 @@ public class WorldEngine {
|
||||
public WorldEngine(SectionStorage storage, @Nullable VoxyInstance instance) {
|
||||
this.instanceIn = instance;
|
||||
|
||||
int cacheSize = 1024;
|
||||
if (Runtime.getRuntime().maxMemory()>=(1L<<32)-200<<20) {
|
||||
cacheSize = 2048;
|
||||
}
|
||||
|
||||
this.storage = storage;
|
||||
this.mapper = new Mapper(this.storage);
|
||||
//5 cache size bits means that the section tracker has 32 separate maps that it uses
|
||||
this.sectionTracker = new ActiveSectionTracker(6, storage::loadSection, 2048, this);
|
||||
this.sectionTracker = new ActiveSectionTracker(6, storage::loadSection, cacheSize, this);
|
||||
}
|
||||
|
||||
public WorldSection acquireIfExists(int lvl, int x, int y, int z) {
|
||||
|
||||
Reference in New Issue
Block a user