MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / _rpmalloc_global_cache_finalize

Function _rpmalloc_global_cache_finalize

source/extern/rpmalloc.c:1441–1457  ·  view source on GitHub ↗

Finalize a global cache

Source from the content-addressed store, hash-verified

1439
1440//! Finalize a global cache
1441static void
1442_rpmalloc_global_cache_finalize(global_cache_t* cache) {
1443 while (!atomic_cas32_acquire(&cache->lock, 1, 0))
1444 _rpmalloc_spin();
1445
1446 for (size_t ispan = 0; ispan < cache->count; ++ispan)
1447 _rpmalloc_span_unmap(cache->span[ispan]);
1448 cache->count = 0;
1449
1450 while (cache->overflow) {
1451 span_t* span = cache->overflow;
1452 cache->overflow = span->next;
1453 _rpmalloc_span_unmap(span);
1454 }
1455
1456 atomic_store32_release(&cache->lock, 0);
1457}
1458
1459static void
1460_rpmalloc_global_cache_insert_spans(span_t** span, size_t span_count, size_t count) {

Callers 1

rpmalloc_finalizeFunction · 0.85

Calls 4

atomic_cas32_acquireFunction · 0.85
_rpmalloc_spinFunction · 0.85
_rpmalloc_span_unmapFunction · 0.85
atomic_store32_releaseFunction · 0.85

Tested by

no test coverage detected