Skip to content

Commit

Permalink
fix: c++ memory release
Browse files Browse the repository at this point in the history
  • Loading branch information
CoolLoong committed Aug 27, 2023
1 parent 669b469 commit 6ecfb0f
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public RocksDBWorldStorage(Path path, Options options) throws WorldStorageExcept
File logFolder = path.resolve("db/log").toFile();
if (!logFolder.exists()) logFolder.mkdirs();
db = RocksDB.open(options, dbFolder.getAbsolutePath());
options.close();
} catch (RocksDBException e) {
throw new WorldStorageException(e);
}
Expand Down Expand Up @@ -110,7 +111,9 @@ public CompletableFuture<Void> writeChunk(Chunk chunk) throws WorldStorageExcept
}
}
);
this.db.write(new WriteOptions(), writeBatch);
try (WriteOptions writeOptions = new WriteOptions()) {
this.db.write(writeOptions, writeBatch);
}
return null;
} catch (RocksDBException e) {
throw new RuntimeException(e);
Expand Down

0 comments on commit 6ecfb0f

Please sign in to comment.