CMemoryPoolPallocManager.cpp 1.3 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
//---------------------------------------------------------------------------
//	Greenplum Database
//	Copyright (C) 2019 Pivotal, Inc.
//
//	@filename:
//		CMemoryPoolPallocManager.cpp
//
//	@doc:
//		MemoryPoolManager implementation that creates
//		CMemoryPoolPalloc memory pools
//
//---------------------------------------------------------------------------

extern "C" {
#include "postgres.h"

#include "utils/memutils.h"
}

#include "gpopt/utils/CMemoryPoolPalloc.h"
#include "gpopt/utils/CMemoryPoolPallocManager.h"

using namespace gpos;

// ctor
J
Jesse Zhang 已提交
26 27 28
CMemoryPoolPallocManager::CMemoryPoolPallocManager(CMemoryPool *internal,
												   EMemoryPoolType)
	: CMemoryPoolManager(internal, EMemoryPoolExternal)
29 30 31 32 33 34 35 36 37 38
{
}

// create new memory pool
CMemoryPool *
CMemoryPoolPallocManager::NewMemoryPool()
{
	return GPOS_NEW(GetInternalMemoryPool()) CMemoryPoolPalloc();
}

39
void
J
Jesse Zhang 已提交
40 41
CMemoryPoolPallocManager::DeleteImpl(void *ptr,
									 CMemoryPool::EAllocationType eat)
42 43 44 45 46 47
{
	CMemoryPoolPalloc::DeleteImpl(ptr, eat);
}

// get user requested size of allocation
ULONG
J
Jesse Zhang 已提交
48
CMemoryPoolPallocManager::UserSizeOfAlloc(const void *ptr)
49 50 51 52
{
	return CMemoryPoolPalloc::UserSizeOfAlloc(ptr);
}

53 54 55
GPOS_RESULT
CMemoryPoolPallocManager::Init()
{
J
Jesse Zhang 已提交
56 57
	return CMemoryPoolManager::SetupGlobalMemoryPoolManager<
		CMemoryPoolPallocManager, CMemoryPoolPalloc>();
58
}
59

60
// EOF