mirror of https://git.kore.io/kore.git
grow kore_pools at a slower rate.
Before we just doubled in size the second we exhausted a pool instead of doing a more controlled expansion. Now we will expand at 25% of the initial elm count whenever we need to. Will help with memory pressure in certain scenarios.
This commit is contained in:
parent
ae2ea0be72
commit
71c145932c
|
@ -441,6 +441,7 @@ struct kore_pool {
|
|||
size_t slen;
|
||||
size_t elms;
|
||||
size_t inuse;
|
||||
size_t growth;
|
||||
volatile int lock;
|
||||
char *name;
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ kore_pool_init(struct kore_pool *pool, const char *name,
|
|||
pool->elms = 0;
|
||||
pool->inuse = 0;
|
||||
pool->elen = len;
|
||||
pool->growth = elm * 0.25f;
|
||||
pool->slen = pool->elen + sizeof(struct kore_pool_entry);
|
||||
|
||||
LIST_INIT(&(pool->regions));
|
||||
|
@ -79,7 +80,7 @@ kore_pool_get(struct kore_pool *pool)
|
|||
#endif
|
||||
|
||||
if (LIST_EMPTY(&(pool->freelist)))
|
||||
pool_region_create(pool, pool->elms);
|
||||
pool_region_create(pool, pool->growth);
|
||||
|
||||
entry = LIST_FIRST(&(pool->freelist));
|
||||
if (entry->state != POOL_ELEMENT_FREE)
|
||||
|
|
Loading…
Reference in New Issue