greenplumn CMemoryPoolPalloc 源码
greenplumn CMemoryPoolPalloc 代码
文件路径:/src/include/gpopt/utils/CMemoryPoolPalloc.h
//---------------------------------------------------------------------------
// Greenplum Database
// Copyright (C) 2019 VMware, Inc. or its affiliates.
//
// @filename:
// CMemoryPoolPalloc.h
//
// @doc:
// CMemoryPool implementation that uses PostgreSQL memory
// contexts.
//
//---------------------------------------------------------------------------
#ifndef GPDXL_CMemoryPoolPalloc_H
#define GPDXL_CMemoryPoolPalloc_H
#include "gpos/base.h"
#include "gpos/memory/CMemoryPool.h"
namespace gpos
{
// Memory pool that maps to a Postgres MemoryContext.
class CMemoryPoolPalloc : public CMemoryPool
{
private:
MemoryContext m_cxt{nullptr};
// When destroying arrays, we need to call the destructor of each element
// To do this, we need the size of the allocation, which we then divide by the
// the size of the element to get number of elements to iterate through.
// This struct is only used for array allocations (GPOS_NEW_ARRAY())
struct SArrayAllocHeader
{
ULONG m_user_size;
};
public:
// ctor
CMemoryPoolPalloc();
// allocate memory
void *NewImpl(const ULONG bytes, const CHAR *file, const ULONG line,
CMemoryPool::EAllocationType eat) override;
// free memory
static void DeleteImpl(void *ptr, CMemoryPool::EAllocationType eat);
// prepare the memory pool to be deleted
void TearDown() override;
// return total allocated size include management overhead
ULLONG TotalAllocatedSize() const override;
// get user requested size of allocation
static ULONG UserSizeOfAlloc(const void *ptr);
};
} // namespace gpos
#endif // !GPDXL_CMemoryPoolPalloc_H
// EOF
相关信息
相关文章
greenplumn CConstExprEvaluatorProxy 源码
0
赞
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦