8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-23 05:23:03 +01:00

Added memory pool describing constant MAX_MEDUIM_BLOCK_SIZE

This commit is contained in:
alexpeshkoff 2015-10-09 11:45:08 +00:00
parent 587ff7b89a
commit 6590c28174
2 changed files with 15 additions and 0 deletions

View File

@ -165,6 +165,9 @@ private:
static MemoryStats* default_stats_group;
public:
// This is maximum block size which is cached (not allocated directly from OS)
enum RecommendedBufferSize { MAX_MEDUIM_BLOCK_SIZE = 64384 }; // MediumLimits::TOP_LIMIT - 128
static MemoryPool* defaultMemoryManager;
public:

View File

@ -579,6 +579,12 @@ void testAllocator()
VERIFY_POOL(pool);
VERIFY_POOL(parent);
printf("Allocate max recommended medium buffer (%d bytes): ", MemoryPool::MAX_MEDUIM_BLOCK_SIZE);
void* maxMedium = pool->allocate(MemoryPool::MAX_MEDUIM_BLOCK_SIZE);
printf(" DONE\n");
VERIFY_POOL(pool);
VERIFY_POOL(parent);
printf("Deallocate the rest of small items in quasi-random order: ");
while (items.getNext()) {
pool->deallocate(items.current().item);
@ -593,6 +599,12 @@ void testAllocator()
} while (bigItems.getNext());
printf(" DONE\n");
printf("Deallocate max recommended medium buffer: ");
pool->deallocate(maxMedium);
printf(" DONE\n");
VERIFY_POOL(pool);
VERIFY_POOL(parent);
printf("Deallocate %d large items: ", LARGE_ITEMS/2);
for (i = 0; i<LARGE_ITEMS/2; i++)
pool->deallocate(la[i]);