MCPcopy Create free account
hub / github.com/acl-dev/acl / memPoolShrink

Function memPoolShrink

lib_acl/src/stdlib/memory/squid_allocator.c:82–100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80}
81
82static void memPoolShrink(SQUID_MEM_ALLOCATOR *allocator,
83 MemPool *pool, size_t new_limit)
84{
85 char *ptr;
86
87 acl_assert(pool);
88 while (pool->meter.idle.level > new_limit
89 && acl_stack_size(((ACL_MEM_POOL *) pool)->pstack) > 0) {
90 memMeterDec(pool->meter.alloc);
91 memMeterDec(pool->meter.idle);
92 memMeterDel(allocator->TheMeter.idle,
93 ((ACL_MEM_POOL *)pool)->obj_size);
94 memMeterDel(allocator->TheMeter.alloc,
95 ((ACL_MEM_POOL *) pool)->obj_size);
96 ptr = acl_stack_pop(((ACL_MEM_POOL *) pool)->pstack);
97 acl_default_free(__FILE__, __LINE__, ptr);
98 }
99 acl_assert(pool->meter.idle.level <= new_limit); /* paranoid */
100}
101
102static void memShrink(SQUID_MEM_ALLOCATOR *allocator, size_t new_limit)
103{

Callers 1

memShrinkFunction · 0.85

Calls 2

acl_stack_sizeFunction · 0.85
acl_stack_popFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…