Skip to content

Commit

Permalink
Fix memory leaking when loading data
Browse files Browse the repository at this point in the history
### What changes are proposed in this pull request?

Release buffer when an exception occurs.

### Why are the changes needed?
Fix memory leaking.

			pr-link: #17758
			change-id: cid-b5e9e655aff744b04d3187687a62dbaed6754186
  • Loading branch information
Haoning-Sun authored and alluxio-bot committed Apr 28, 2024
1 parent 0d22591 commit 3c71a78
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -343,12 +343,12 @@ public CompletableFuture<List<BlockStatus>> load(List<Block> blocks, UfsReadOpti
blockWriter.close();
} catch (IOException e) {
throw AlluxioRuntimeException.from(e);
} finally {
NioDirectBufferPool.release(buf);
}
})
.thenRun(() -> commitBlock(sessionId, blockId, false))
.thenRun(() -> NioDirectBufferPool.release(buf))
.exceptionally(t -> {
NioDirectBufferPool.release(buf);
handleException(t.getCause(), block, errors, sessionId);
return null;
});
Expand Down

0 comments on commit 3c71a78

Please sign in to comment.