MCPcopy Create free account
hub / github.com/catboost/catboost / GetAlignedMemory

Function GetAlignedMemory

library/cpp/coroutine/engine/stack/stack_utils.cpp:18–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16
17#ifdef _linux_
18 bool GetAlignedMemory(size_t sizeInPages, char*& rawPtr, char*& alignedPtr) noexcept {
19 Y_ASSERT(sizeInPages);
20
21 void* ptr = nullptr;
22 int error = posix_memalign(&ptr, PageSize, sizeInPages * PageSize);
23 alignedPtr = rawPtr = (char*)ptr;
24 return rawPtr && alignedPtr && !error;
25 }
26#else
27 bool GetAlignedMemory(size_t sizeInPages, char*& rawPtr, char*& alignedPtr) noexcept {
28 Y_ASSERT(sizeInPages);

Callers 6

BM_GetAlignedMemoryFunction · 0.85
TESTFunction · 0.85
TYPED_TESTFunction · 0.85
TESTFunction · 0.85
SetUpMethod · 0.85

Calls 2

posix_memalignFunction · 0.50
mallocFunction · 0.50

Tested by

no test coverage detected