Data-SortedSet-Shared
view release on metacpan or search on metacpan
{
uint32_t count, max_entries, height, node_capacity, index_slots, nodes_used;
uint64_t ops;
/* Snapshot the header fields under the lock; do all (croak-capable) Perl
allocation after releasing it -- an OOM in newHV/newSVuv must never
strand the read lock. */
if (!h->readonly) ss_rwlock_rdlock(h); /* frozen: immutable, no lock */
SsHeader *hd = h->hdr;
uint32_t nfree = 0, f = hd->node_free_head;
/* node_free_head / parent free-links are file-stored: bound the index and
cap iterations so a crafted out-of-range or cyclic free-list can't OOB
or spin (never taken for a valid free-list of length <= node_capacity) */
while (f != SS_NONE && ss_node_ok(h, f) && nfree <= h->node_capacity) { nfree++; f = h->nodes[f].parent; } /* cached cap: trusted anti-spin bound */
count = hd->count; /* backward-shift delete leaves no tombstones: occupied slots == count */
max_entries = hd->max_entries;
height = hd->height;
node_capacity = hd->node_capacity;
index_slots = hd->index_slots;
nodes_used = hd->node_capacity - nfree;
ops = hd->stat_ops;
if (!h->readonly) ss_rwlock_rdunlock(h);
( run in 0.678 second using v1.01-cache-2.11-cpan-4ab04211f4c )