Skip to content

Commit

Permalink
More asserts.
Browse files Browse the repository at this point in the history
  • Loading branch information
ClaytonKnittel committed Nov 30, 2024
1 parent 6e2bd5d commit 970bec5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/ckmalloc/main_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ template <MetadataAllocInterface MetadataAlloc, SlabMapInterface SlabMap,
void MainAllocatorImpl<MetadataAlloc, SlabMap, SmallAllocator,
LargeAllocator>::Free(Void* ptr) {
Slab* slab = slab_map_->FindSlab(PageId::FromPtr(ptr));
CK_ASSERT_NE(slab, nullptr);
CK_ASSERT_NE(slab->Type(), SlabType::kFree);
CK_ASSERT_NE(slab->Type(), SlabType::kUnmapped);

Expand Down
4 changes: 2 additions & 2 deletions src/ckmalloc/slab_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,10 +172,10 @@ class SlabMapImpl {
};

template <typename T>
T* Allocate();
T* Allocate() CK_EXCLUSIVE_LOCKS_REQUIRED(path_allocator_mutex_);

template <typename T>
void Free(T* node);
void Free(T* node) CK_EXCLUSIVE_LOCKS_REQUIRED(path_allocator_mutex_);

static size_t RootIdx(PageId page_id) {
return page_id.Idx() / (kNodeSize * kNodeSize);
Expand Down

0 comments on commit 970bec5

Please sign in to comment.