summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vespalib/src/vespa/vespalib/util/alloc.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/vespalib/src/vespa/vespalib/util/alloc.cpp b/vespalib/src/vespa/vespalib/util/alloc.cpp
index 0a83d39ca09..ed620ec0afe 100644
--- a/vespalib/src/vespa/vespalib/util/alloc.cpp
+++ b/vespalib/src/vespa/vespalib/util/alloc.cpp
@@ -454,33 +454,33 @@ AutoAllocator::resize_inplace(PtrAndSize current, size_t newSize) const {
MMapAllocator::PtrAndSize
AutoAllocator::alloc(size_t sz) const {
- if (useMMap(sz)) {
- sz = roundUpToHugePages(sz);
- return MMapAllocator::salloc(sz, nullptr);
- } else {
+ if ( ! useMMap(sz)) {
if (_alignment == 0) {
return HeapAllocator::salloc(sz);
} else {
return AlignedHeapAllocator(_alignment).alloc(sz);
}
+ } else {
+ sz = roundUpToHugePages(sz);
+ return MMapAllocator::salloc(sz, nullptr);
}
}
void
AutoAllocator::free(PtrAndSize alloc) const {
- if (isMMapped(alloc.second)) {
- return MMapAllocator::sfree(alloc);
- } else {
+ if ( ! isMMapped(alloc.second)) {
return HeapAllocator::sfree(alloc);
+ } else {
+ return MMapAllocator::sfree(alloc);
}
}
void
AutoAllocator::free(void * ptr, size_t sz) const {
- if (useMMap(sz)) {
- return MMapAllocator::sfree(PtrAndSize(ptr, roundUpToHugePages(sz)));
- } else {
+ if ( ! useMMap(sz)) {
return HeapAllocator::sfree(PtrAndSize(ptr, sz));
+ } else {
+ return MMapAllocator::sfree(PtrAndSize(ptr, roundUpToHugePages(sz)));
}
}