alloc: account for page size
diff --git a/kotlin-native/runtime/src/alloc/custom/cpp/SingleObjectPage.cpp b/kotlin-native/runtime/src/alloc/custom/cpp/SingleObjectPage.cpp index d62a91e..c093d17 100644 --- a/kotlin-native/runtime/src/alloc/custom/cpp/SingleObjectPage.cpp +++ b/kotlin-native/runtime/src/alloc/custom/cpp/SingleObjectPage.cpp
@@ -24,7 +24,7 @@ SingleObjectPage::SingleObjectPage(AllocationSize objectSize) noexcept { auto& heap = mm::GlobalData::Instance().allocator().impl().heap(); - heap.allocatedSizeTracker().recordDifferenceAndNotifyScheduler(static_cast<ptrdiff_t>(objectSize.inBytes())); + heap.allocatedSizeTracker().recordDifferenceAndNotifyScheduler(static_cast<ptrdiff_t>(pageSize(objectSize).inBytes())); } uint8_t* SingleObjectPage::Data() noexcept { @@ -49,7 +49,7 @@ void SingleObjectPage::destroyImpl(AllocationSize objectSize) noexcept { auto& heap = mm::GlobalData::Instance().allocator().impl().heap(); - heap.allocatedSizeTracker().recordDifference(-static_cast<ptrdiff_t>(objectSize.inBytes())); + heap.allocatedSizeTracker().recordDifference(-static_cast<ptrdiff_t>(pageSize(objectSize).inBytes())); Free(this, pageSize(objectSize).inBytes()); }