Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debug_check_empty #521

Merged
merged 1 commit into from
May 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions src/snmalloc/mem/corealloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -893,24 +893,29 @@ namespace snmalloc
*/
bool debug_is_empty_impl(bool* result)
{
auto test = [&result](auto& queue) {
queue.filter([&result](auto slab_metadata) {
auto test = [&result](auto& queue, smallsizeclass_t size_class) {
queue.filter([&result, size_class](auto slab_metadata) {
if (slab_metadata->needed() != 0)
{
if (result != nullptr)
*result = false;
else
error("debug_is_empty: found non-empty allocator");
report_fatal_error(
"debug_is_empty: found non-empty allocator: size={} ({})",
sizeclass_to_size(size_class),
size_class);
}
return false;
});
};

bool sent_something = flush(true);

smallsizeclass_t size_class = 0;
for (auto& alloc_class : alloc_classes)
{
test(alloc_class.available);
test(alloc_class.available, size_class);
size_class++;
}

// Place the static stub message on the queue.
Expand Down