You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-07 03:22:57 +03:00
feat(): propagated changes into SLTPoolAllocator and friends
This commit is contained in:
@@ -23,7 +23,8 @@
|
||||
#include <iostream>
|
||||
//#define NDEBUG
|
||||
#include <cassert>
|
||||
|
||||
#include <boost/smart_ptr/allocate_shared_array.hpp>
|
||||
#include <boost/smart_ptr/make_shared_array.hpp>
|
||||
|
||||
#include "poolallocator.h"
|
||||
|
||||
@@ -37,6 +38,7 @@ PoolAllocator& PoolAllocator::operator=(const PoolAllocator& v)
|
||||
allocSize = v.allocSize;
|
||||
tmpSpace = v.tmpSpace;
|
||||
useLock = v.useLock;
|
||||
alloc = v.alloc;
|
||||
deallocateAll();
|
||||
return *this;
|
||||
}
|
||||
@@ -46,21 +48,29 @@ void PoolAllocator::deallocateAll()
|
||||
capacityRemaining = 0;
|
||||
nextAlloc = NULL;
|
||||
memUsage = 0;
|
||||
// WIP double check the space is cleaned up.
|
||||
mem.clear();
|
||||
oob.clear();
|
||||
}
|
||||
|
||||
void PoolAllocator::newBlock()
|
||||
{
|
||||
std::shared_ptr<PoolAllocatorBufType[]> next;
|
||||
// boost::shared_ptr<PoolAllocatorBufType[]> next;
|
||||
|
||||
capacityRemaining = allocSize;
|
||||
|
||||
if (!tmpSpace || mem.size() == 0)
|
||||
{
|
||||
next.reset(new PoolAllocatorBufType[allocSize]);
|
||||
mem.push_back(next);
|
||||
nextAlloc = next.get();
|
||||
if (alloc)
|
||||
{
|
||||
mem.emplace_back(boost::allocate_shared<PoolAllocatorBufType>(*alloc, allocSize));
|
||||
}
|
||||
else
|
||||
{
|
||||
mem.emplace_back(boost::make_shared<PoolAllocatorBufType>(allocSize));
|
||||
}
|
||||
// mem.push_back(next);
|
||||
nextAlloc = mem.back().get();
|
||||
}
|
||||
else
|
||||
nextAlloc = mem.front().get();
|
||||
@@ -71,7 +81,14 @@ void* PoolAllocator::allocOOB(uint64_t size)
|
||||
OOBMemInfo memInfo;
|
||||
|
||||
memUsage += size;
|
||||
memInfo.mem.reset(new PoolAllocatorBufType[size]);
|
||||
if (alloc)
|
||||
{
|
||||
memInfo.mem = boost::allocate_shared<PoolAllocatorBufType>(*alloc, size);
|
||||
}
|
||||
else
|
||||
{
|
||||
memInfo.mem = boost::make_shared<PoolAllocatorBufType>(size);
|
||||
}
|
||||
memInfo.size = size;
|
||||
void* ret = (void*)memInfo.mem.get();
|
||||
oob[ret] = memInfo;
|
||||
|
Reference in New Issue
Block a user