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:
parent
587ff7b89a
commit
6590c28174
@ -165,6 +165,9 @@ private:
|
|||||||
static MemoryStats* default_stats_group;
|
static MemoryStats* default_stats_group;
|
||||||
|
|
||||||
public:
|
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;
|
static MemoryPool* defaultMemoryManager;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -579,6 +579,12 @@ void testAllocator()
|
|||||||
VERIFY_POOL(pool);
|
VERIFY_POOL(pool);
|
||||||
VERIFY_POOL(parent);
|
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: ");
|
printf("Deallocate the rest of small items in quasi-random order: ");
|
||||||
while (items.getNext()) {
|
while (items.getNext()) {
|
||||||
pool->deallocate(items.current().item);
|
pool->deallocate(items.current().item);
|
||||||
@ -593,6 +599,12 @@ void testAllocator()
|
|||||||
} while (bigItems.getNext());
|
} while (bigItems.getNext());
|
||||||
printf(" DONE\n");
|
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);
|
printf("Deallocate %d large items: ", LARGE_ITEMS/2);
|
||||||
for (i = 0; i<LARGE_ITEMS/2; i++)
|
for (i = 0; i<LARGE_ITEMS/2; i++)
|
||||||
pool->deallocate(la[i]);
|
pool->deallocate(la[i]);
|
||||||
|
Loading…
Reference in New Issue
Block a user