aboutsummaryrefslogtreecommitdiffstats
path: root/util/memory/alloc.cpp
blob: 0ce76855e141611a23ffc97e2c3e38fd35998b53 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "alloc.h"

#include <util/generic/singleton.h>
#include <util/system/sys_alloc.h>

using TBlock = TDefaultAllocator::TBlock;

TBlock TDefaultAllocator::Allocate(size_t len) {
    TBlock ret = {y_allocate(len), len};

    return ret;
}

void TDefaultAllocator::Release(const TBlock& block) {
    y_deallocate(block.Data);
}

IAllocator* TDefaultAllocator::Instance() noexcept { 
    return SingletonWithPriority<TDefaultAllocator, 0>();
}