mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-24 03:23:03 +01:00
Cleanup.
This commit is contained in:
parent
32acb864fb
commit
e3e9d3c172
@ -246,8 +246,8 @@ MemoryPool* MemoryPool::getContextPool()
|
||||
}
|
||||
|
||||
// Default stats group and default pool
|
||||
MemoryStats* MemoryPool::default_stats_group = 0;
|
||||
MemoryPool* MemoryPool::processMemoryPool = 0;
|
||||
MemoryStats* MemoryPool::default_stats_group = NULL;
|
||||
MemoryPool* MemoryPool::processMemoryPool = NULL;
|
||||
|
||||
// Initialize process memory pool (called from InstanceControl).
|
||||
// At this point also set contextMemoryPool for main thread
|
||||
@ -1072,7 +1072,7 @@ void MemoryPool::print_contents(FILE *file, bool used_only,
|
||||
fprintf(file, "********* End of output for pool %p.\n", this);
|
||||
}
|
||||
|
||||
MemoryPool* MemoryPool::internal_create(size_t instance_size, MemoryPool* parent, MemoryStats &stats)
|
||||
MemoryPool* MemoryPool::createPool(MemoryPool* parent, MemoryStats &stats)
|
||||
{
|
||||
MemoryPool *pool;
|
||||
#ifndef USE_VALGRIND
|
||||
@ -1081,7 +1081,7 @@ MemoryPool* MemoryPool::internal_create(size_t instance_size, MemoryPool* parent
|
||||
// difficult to make memory pass through any delayed free list in this case
|
||||
if (parent) {
|
||||
parent->lock.enter();
|
||||
const size_t size = MEM_ALIGN(instance_size + sizeof(MemoryRedirectList));
|
||||
const size_t size = MEM_ALIGN(sizeof(MemoryPool) + sizeof(MemoryRedirectList));
|
||||
void* mem = parent->internal_alloc(size, TYPE_POOL);
|
||||
if (!mem) {
|
||||
parent->lock.leave();
|
||||
@ -1107,7 +1107,7 @@ MemoryPool* MemoryPool::internal_create(size_t instance_size, MemoryPool* parent
|
||||
// This is the exact initial layout of memory pool in the first extent //
|
||||
// MemoryExtent
|
||||
// MemoryBlock
|
||||
// MemoryPool (instance_size)
|
||||
// MemoryPool
|
||||
// MemoryBlock
|
||||
// FreeBlocksTree::ItemList
|
||||
// MemoryBlock
|
||||
@ -1130,7 +1130,7 @@ MemoryPool* MemoryPool::internal_create(size_t instance_size, MemoryPool* parent
|
||||
MemoryPool(NULL, stats, mem, mem +
|
||||
MEM_ALIGN(sizeof(MemoryExtent)) +
|
||||
MEM_ALIGN(sizeof(MemoryBlock)) +
|
||||
MEM_ALIGN(instance_size) +
|
||||
MEM_ALIGN(sizeof(MemoryPool)) +
|
||||
MEM_ALIGN(sizeof(MemoryBlock)));
|
||||
|
||||
pool->increment_mapping(EXTENT_SIZE);
|
||||
@ -1139,13 +1139,13 @@ MemoryPool* MemoryPool::internal_create(size_t instance_size, MemoryPool* parent
|
||||
poolBlk->mbk_pool = pool;
|
||||
poolBlk->mbk_flags = MBK_USED;
|
||||
poolBlk->mbk_type = TYPE_POOL;
|
||||
poolBlk->mbk_small.mbk_length = MEM_ALIGN(instance_size);
|
||||
poolBlk->mbk_small.mbk_length = MEM_ALIGN(sizeof(MemoryPool));
|
||||
poolBlk->mbk_small.mbk_prev_length = 0;
|
||||
|
||||
MemoryBlock* hdr = (MemoryBlock*) (mem +
|
||||
MEM_ALIGN(sizeof(MemoryExtent)) +
|
||||
MEM_ALIGN(sizeof(MemoryBlock)) +
|
||||
MEM_ALIGN(instance_size));
|
||||
MEM_ALIGN(sizeof(MemoryPool)));
|
||||
hdr->mbk_pool = pool;
|
||||
hdr->mbk_flags = MBK_USED;
|
||||
hdr->mbk_type = TYPE_LEAFPAGE;
|
||||
@ -1154,13 +1154,13 @@ MemoryPool* MemoryPool::internal_create(size_t instance_size, MemoryPool* parent
|
||||
MemoryBlock* blk = (MemoryBlock *)(mem +
|
||||
MEM_ALIGN(sizeof(MemoryExtent)) +
|
||||
MEM_ALIGN(sizeof(MemoryBlock)) +
|
||||
MEM_ALIGN(instance_size) +
|
||||
MEM_ALIGN(sizeof(MemoryPool)) +
|
||||
MEM_ALIGN(sizeof(MemoryBlock)) +
|
||||
MEM_ALIGN(sizeof(FreeBlocksTree::ItemList)));
|
||||
int blockLength = EXTENT_SIZE -
|
||||
MEM_ALIGN(sizeof(MemoryExtent)) -
|
||||
MEM_ALIGN(sizeof(MemoryBlock)) -
|
||||
MEM_ALIGN(instance_size) -
|
||||
MEM_ALIGN(sizeof(MemoryPool)) -
|
||||
MEM_ALIGN(sizeof(MemoryBlock)) -
|
||||
MEM_ALIGN(sizeof(FreeBlocksTree::ItemList)) -
|
||||
MEM_ALIGN(sizeof(MemoryBlock));
|
||||
|
@ -294,10 +294,6 @@ protected:
|
||||
~MemoryPool() {
|
||||
}
|
||||
|
||||
// Used to create MemoryPool descendants
|
||||
static MemoryPool* internal_create(size_t instance_size,
|
||||
MemoryPool* parent = NULL, MemoryStats& stats = *default_stats_group);
|
||||
|
||||
public:
|
||||
// Default statistics group for process
|
||||
static MemoryStats* default_stats_group;
|
||||
@ -306,9 +302,8 @@ public:
|
||||
static MemoryPool* processMemoryPool;
|
||||
|
||||
// Create memory pool instance
|
||||
static MemoryPool* createPool(MemoryPool* parent = NULL, MemoryStats& stats = *default_stats_group) {
|
||||
return internal_create(sizeof(MemoryPool), parent, stats);
|
||||
}
|
||||
static MemoryPool* createPool(MemoryPool* parent = NULL,
|
||||
MemoryStats& stats = *default_stats_group);
|
||||
|
||||
// Set context pool for current thread of execution
|
||||
static MemoryPool* setContextPool(MemoryPool* newPool);
|
||||
|
Loading…
Reference in New Issue
Block a user