Bug fix for superslab meta-data (#302)

* Replace time measuring macro

The DO_TIME macro was used originally to get performance numbers. The
macro makes tests hard to debug. This commit replaces it with a proper
C++ class with destructor.

* Bug fix

If the superslab meta data is large, then the calculation for the
sizeclasses that could use the short slab was incorrect.  This fixes
that calculation.

Co-authored-by: Nathaniel Wesley Filardo <nfilardo@microsoft.com>
This commit is contained in:
Matthew Parkinson
2021-03-23 12:42:11 +00:00
committed by GitHub
parent 04a185e634
commit 63f231f484
7 changed files with 91 additions and 57 deletions

View File

@@ -32,8 +32,7 @@ namespace snmalloc
static SNMALLOC_FAST_PATH void
alloc_new_list(void*& bumpptr, FreeListIter& fast_free_list, size_t rsize)
{
void* slab_end =
pointer_align_up<SLAB_SIZE>(pointer_offset(bumpptr, rsize));
void* slab_end = pointer_align_up<SLAB_SIZE>(pointer_offset(bumpptr, 1));
FreeListBuilder b;
SNMALLOC_ASSERT(b.empty());