Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ static constexpr int kMapShared = 1;
static constexpr int kMapShared = kMeshingEnabled ? MAP_SHARED : MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE;
#endif

// we have to define this here for use in meshable_arena's CheapHeap we allocate
// MiniHeaps out of. We validate (and fail compilation) if this gets out of date
// with a static_assert at the bottom of mini_heap.h
static constexpr size_t kMiniHeapSize = 64;

static constexpr size_t kMinObjectSize = 16;
static constexpr size_t kMaxSize = 16384;
static constexpr size_t kClassSizesMax = 25;
Expand Down
2 changes: 1 addition & 1 deletion src/meshable_arena.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ class MeshableArena : public mesh::OneWayMmapHeap {
atomic<MiniHeapID> *_mhIndex{nullptr};

protected:
CheapHeap<64, kArenaSize / kPageSize> _mhAllocator{};
CheapHeap<kMiniHeapSize, kArenaSize / kPageSize> _mhAllocator{};
MWC _fastPrng;

private:
Expand Down
1 change: 1 addition & 0 deletions src/mini_heap.h
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,7 @@ typedef FixedArray<MiniHeap, 63> MiniHeapArray;
static_assert(sizeof(pid_t) == 4, "pid_t not 32-bits!");
static_assert(sizeof(mesh::internal::Bitmap) == 32, "Bitmap too big!");
static_assert(sizeof(MiniHeap) == 64, "MiniHeap too big!");
static_assert(sizeof(MiniHeap) == kMiniHeapSize, "MiniHeap size mismatch");
static_assert(sizeof(MiniHeapArray) == 64 * sizeof(void *), "MiniHeapArray too big!");
} // namespace mesh

Expand Down