Merge pull request #99 from CTSRD-CHERI/for-upstream-stats-underflow
Fix stats underflow
This commit is contained in:
@@ -895,13 +895,15 @@ namespace snmalloc
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Destroy the message queue so that it has no stub message.
|
// Destroy the message queue so that it has no stub message.
|
||||||
Remote* p = message_queue().destroy();
|
|
||||||
|
|
||||||
while (p != nullptr)
|
|
||||||
{
|
{
|
||||||
Remote* n = p->non_atomic_next;
|
Remote* p = message_queue().destroy();
|
||||||
handle_dealloc_remote(p);
|
|
||||||
p = n;
|
while (p != nullptr)
|
||||||
|
{
|
||||||
|
Remote* n = p->non_atomic_next;
|
||||||
|
handle_dealloc_remote(p);
|
||||||
|
p = n;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < NUM_SMALL_CLASSES; i++)
|
for (size_t i = 0; i < NUM_SMALL_CLASSES; i++)
|
||||||
@@ -911,7 +913,10 @@ namespace snmalloc
|
|||||||
while (prev != nullptr)
|
while (prev != nullptr)
|
||||||
{
|
{
|
||||||
auto n = Metaslab::follow_next(prev);
|
auto n = Metaslab::follow_next(prev);
|
||||||
dealloc(remove_cache_friendly_offset(prev, i));
|
|
||||||
|
Superslab* super = Superslab::get(prev);
|
||||||
|
small_dealloc_offseted_inner(super, prev, i);
|
||||||
|
|
||||||
prev = n;
|
prev = n;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1222,6 +1227,12 @@ namespace snmalloc
|
|||||||
MEASURE_TIME(small_dealloc, 4, 16);
|
MEASURE_TIME(small_dealloc, 4, 16);
|
||||||
stats().sizeclass_dealloc(sizeclass);
|
stats().sizeclass_dealloc(sizeclass);
|
||||||
|
|
||||||
|
small_dealloc_offseted_inner(super, p, sizeclass);
|
||||||
|
}
|
||||||
|
|
||||||
|
SNMALLOC_FAST_PATH void small_dealloc_offseted_inner(
|
||||||
|
Superslab* super, void* p, sizeclass_t sizeclass)
|
||||||
|
{
|
||||||
Slab* slab = Slab::get(p);
|
Slab* slab = Slab::get(p);
|
||||||
if (likely(slab->dealloc_fast(super, p)))
|
if (likely(slab->dealloc_fast(super, p)))
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ namespace snmalloc
|
|||||||
|
|
||||||
void dec()
|
void dec()
|
||||||
{
|
{
|
||||||
|
assert(current > 0);
|
||||||
current--;
|
current--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user