Previously, when a slab allocation failed in evict mode, only 16
entries were evicted with a single retry. This could still result
in SharedMemoryError when the freed slab slots did not match the
requested allocation size class, even though the zone had plenty
of evictable entries.
In practice, it might happen when the following conditions are met:
- The shared zone is full
- evict flag is enabled
- key/value entries differ in size
The allocation now retries in a loop, evicting 16 entries at a time,
until the allocation succeeds or no more entries remain in the expire
tree.
After this change, allocation with evict enabled can only fail when:
- the value is larger than the zone's usable space
- the expire tree has no entries left to evict
- zone metadata overhead leaves insufficient room