diff options
author | Tor Egge <Tor.Egge@broadpark.no> | 2021-02-13 23:43:31 +0100 |
---|---|---|
committer | Tor Egge <Tor.Egge@broadpark.no> | 2021-02-13 23:52:02 +0100 |
commit | 3ecf2e1b0aeed121fa8b588bbe3e50a70386c91d (patch) | |
tree | 75998f42eedef44f28019035ca070b4331bfa2c0 /vespalib | |
parent | ecee339b9aa8793a8689b1916821027ae1f48503 (diff) |
Add alloc_aligned member function.
Diffstat (limited to 'vespalib')
-rw-r--r-- | vespalib/src/vespa/vespalib/util/alloc.cpp | 6 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/util/alloc.h | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/vespalib/src/vespa/vespalib/util/alloc.cpp b/vespalib/src/vespa/vespalib/util/alloc.cpp index 511593ba1d6..3cd8844dd73 100644 --- a/vespalib/src/vespa/vespalib/util/alloc.cpp +++ b/vespalib/src/vespa/vespalib/util/alloc.cpp @@ -546,6 +546,12 @@ Alloc::alloc(size_t sz) noexcept } Alloc +Alloc::alloc_aligned(size_t sz, size_t alignment) noexcept +{ + return Alloc(&AutoAllocator::getAllocator(MemoryAllocator::HUGEPAGE_SIZE, alignment), sz); +} + +Alloc Alloc::alloc(size_t sz, size_t mmapLimit, size_t alignment) noexcept { return Alloc(&AutoAllocator::getAllocator(mmapLimit, alignment), sz); diff --git a/vespalib/src/vespa/vespalib/util/alloc.h b/vespalib/src/vespa/vespalib/util/alloc.h index 5e71180f9be..71a3bd2407a 100644 --- a/vespalib/src/vespa/vespalib/util/alloc.h +++ b/vespalib/src/vespa/vespalib/util/alloc.h @@ -60,6 +60,7 @@ public: * is always used when size is above limit. */ static Alloc alloc(size_t sz) noexcept; + static Alloc alloc_aligned(size_t sz, size_t alignment) noexcept; static Alloc alloc(size_t sz, size_t mmapLimit, size_t alignment=0) noexcept; static Alloc alloc() noexcept; static Alloc alloc_with_allocator(const MemoryAllocator* allocator) noexcept; |