You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
fix(perf,allocator): adding unit test to check CountingAllocator behavior when it is wrapped in STLPoolAllocator
This commit is contained in:
@ -25,6 +25,8 @@
|
||||
#include <boost/smart_ptr/allocate_shared_array.hpp>
|
||||
#include <boost/smart_ptr/make_shared_array.hpp>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include "poolallocator.h"
|
||||
|
||||
using namespace std;
|
||||
@ -34,6 +36,7 @@ namespace utils
|
||||
{
|
||||
PoolAllocator& PoolAllocator::operator=(const PoolAllocator& v)
|
||||
{
|
||||
std::cout << "PoolAllocator copy assignment" << std::endl;
|
||||
allocSize = v.allocSize;
|
||||
tmpSpace = v.tmpSpace;
|
||||
useLock = v.useLock;
|
||||
@ -54,15 +57,19 @@ void PoolAllocator::deallocateAll()
|
||||
void PoolAllocator::newBlock()
|
||||
{
|
||||
capacityRemaining = allocSize;
|
||||
std::cout << "PoolAllocator new block" << std::endl;
|
||||
|
||||
if (!tmpSpace || mem.size() == 0)
|
||||
{
|
||||
if (alloc)
|
||||
{
|
||||
std::cout << "PoolAllocator new block with counting alloc" << std::endl;
|
||||
|
||||
mem.emplace_back(boost::allocate_shared<PoolAllocatorBufType>(*alloc, allocSize));
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "PoolAllocator new block w/o counting alloc" << std::endl;
|
||||
mem.emplace_back(boost::make_shared<PoolAllocatorBufType>(allocSize));
|
||||
}
|
||||
nextAlloc = mem.back().get();
|
||||
@ -74,14 +81,17 @@ void PoolAllocator::newBlock()
|
||||
void* PoolAllocator::allocOOB(uint64_t size)
|
||||
{
|
||||
OOBMemInfo memInfo;
|
||||
std::cout << "PoolAllocator allocOOB" << std::endl;
|
||||
|
||||
memUsage += size;
|
||||
if (alloc)
|
||||
{
|
||||
std::cout << "PoolAllocator allocOOB with counting alloc" << std::endl;
|
||||
memInfo.mem = boost::allocate_shared<PoolAllocatorBufType>(*alloc, size);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "PoolAllocator allocOOB w/o counting alloc" << std::endl;
|
||||
memInfo.mem = boost::make_shared<PoolAllocatorBufType>(size);
|
||||
}
|
||||
memInfo.size = size;
|
||||
|
Reference in New Issue
Block a user