Skip to content

Commit

Permalink
Added closing of the FileChannel and associated InputStream after cre…
Browse files Browse the repository at this point in the history
…ation of the MMapTable instance
  • Loading branch information
hbs authored and dain committed Jun 26, 2019
1 parent 8a89086 commit 435ceef
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions leveldb/src/main/java/org/iq80/leveldb/impl/TableCache.java
Expand Up @@ -127,6 +127,8 @@ private TableAndFile(File databaseDir, long fileNumber, UserComparator userCompa
FileChannel fileChannel = fis.getChannel();
if (Iq80DBFactory.USE_MMAP) {
table = new MMapTable(tableFile.getAbsolutePath(), fileChannel, userComparator, verifyChecksums);
// We can close the channel and input stream as the mapping does not need them
Closeables.closeQuietly(fis);
}
else {
table = new FileChannelTable(tableFile.getAbsolutePath(), fileChannel, userComparator, verifyChecksums);
Expand Down

0 comments on commit 435ceef

Please sign in to comment.