Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions src/memory/common/GlobalMemoryAllocator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ namespace hf3fs::memory {
#ifdef OVERRIDE_CXX_NEW_DELETE

static std::once_flag gInitOnce;
static bool gAllocatorInited = false;
static MemoryAllocatorInterface *gAllocator = nullptr;
static thread_local hf3fs::memory::AllocatedMemoryCounter gMemCounter;

Expand Down Expand Up @@ -73,10 +72,7 @@ static void loadMemoryAllocatorLib() {
}

void *allocate(size_t size) {
if (!gAllocatorInited) {
std::call_once(gInitOnce, loadMemoryAllocatorLib);
gAllocatorInited = true;
}
std::call_once(gInitOnce, loadMemoryAllocatorLib);

#ifdef SAVE_ALLOCATE_SIZE
const size_t headerSize = kHeaderSize;
Expand Down Expand Up @@ -130,10 +126,7 @@ void deallocate(void *mem) {
}

void *memalign(size_t alignment, size_t size) {
if (!gAllocatorInited) {
std::call_once(gInitOnce, loadMemoryAllocatorLib);
gAllocatorInited = true;
}
std::call_once(gInitOnce, loadMemoryAllocatorLib);

#ifdef SAVE_ALLOCATE_SIZE
const size_t alignedHeaderSize = std::max(alignment, kHeaderSize);
Expand Down