aboutsummaryrefslogtreecommitdiffstats
path: root/util/memory/alloc.cpp
blob: 50ccb1b25d51b4d0e390e5016b103c2835824e66 (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>(); 
}