Merge pull request #84 from microsoft/bug-fix

Bug fix
This commit is contained in:
David Chisnall
2019-08-13 16:57:21 +01:00
committed by GitHub
14 changed files with 128 additions and 33 deletions

View File

@@ -1084,13 +1084,13 @@ namespace snmalloc
SNMALLOC_ASSUME(size <= SLAB_SIZE);
sizeclass_t sizeclass = size_to_sizeclass(size);
stats().sizeclass_alloc(sizeclass);
assert(sizeclass < NUM_SMALL_CLASSES);
auto& fl = small_fast_free_lists[sizeclass];
void* head = fl.value;
if (likely(head != nullptr))
{
stats().sizeclass_alloc(sizeclass);
// Read the next slot from the memory that's about to be allocated.
fl.value = Metaslab::follow_next(head);
@@ -1113,6 +1113,9 @@ namespace snmalloc
return reinterpret_cast<Allocator*>(replacement)
->template small_alloc_slow<zero_mem, allow_reserve>(sizeclass);
}
stats().sizeclass_alloc(sizeclass);
handle_message_queue();
size_t rsize = sizeclass_to_size(sizeclass);
auto& sl = small_classes[sizeclass];