Skip to content

Commit

Permalink
memory leaks are joever
Browse files Browse the repository at this point in the history
  • Loading branch information
leijurv committed Jun 30, 2023
1 parent 15f4253 commit 8211ae4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/api/java/baritone/api/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,13 @@ public final class Settings {
*/
public final Setting<Boolean> pruneRegionsFromRAM = new Setting<>(true);

/**
* The chunk packer queue can never grow to larger than this, if it does, the oldest chunks are discarded
* <p>
* The newest chunks are kept, so that if you're moving in a straight line quickly then stop, your immediate render distance is still included
*/
public final Setting<Integer> chunkPackerQueueMaxSize = new Setting<>(2000);

/**
* Fill in blocks behind you
*/
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/baritone/cache/CachedWorld.java
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,9 @@ public void run() {
try {
ChunkPos pos = toPackQueue.take();
Chunk chunk = toPackMap.remove(pos);
if (toPackQueue.size() > Baritone.settings().chunkPackerQueueMaxSize.value) {
continue;
}
CachedChunk cached = ChunkPacker.pack(chunk);
CachedWorld.this.updateCachedChunk(cached);
//System.out.println("Processed chunk at " + chunk.x + "," + chunk.z);
Expand Down

0 comments on commit 8211ae4

Please sign in to comment.