Skip to content

Commit

Permalink
Handling MAP_FAILED in MmapAllocator (facebookincubator#9228)
Browse files Browse the repository at this point in the history
Summary:
This PR is addressing this issue facebookincubator#9135

Pull Request resolved: facebookincubator#9228

Reviewed By: Yuhta

Differential Revision: D55609322

Pulled By: xiaoxmeng

fbshipit-source-id: c1921fd5551c553384fde4ffddf80ad659471094
  • Loading branch information
willsfeng authored and facebook-github-bot committed Apr 6, 2024
1 parent a42079c commit 84ae6bf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions velox/common/memory/MmapAllocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,12 +336,12 @@ bool MmapAllocator::allocateContiguousImpl(
0);
}
}
// TODO: add handling of MAP_FAILED.
if (data == nullptr) {
if (data == nullptr || data == MAP_FAILED) {
const std::string errorMsg = fmt::format(
"Mmap failed with {} pages use MmapArena {}",
"Mmap failed with {} pages use MmapArena {}, errno {}",
numPages,
(useMmapArena_ ? "true" : "false"));
(useMmapArena_ ? "true" : "false"),
folly::errnoStr(errno));
VELOX_MEM_LOG(ERROR) << errorMsg;
setAllocatorFailureMessage(errorMsg);
// If the mmap failed, we have unmapped former 'allocation' and the extra to
Expand Down

0 comments on commit 84ae6bf

Please sign in to comment.