Skip to content

Commit adeecfb

Browse files
committed
Added bug fix to alignment of using.
1 parent 8b9a525 commit adeecfb

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/mem/largealloc.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,13 +196,15 @@ namespace snmalloc
196196
memory_provider.template zero<true>(p, OS_PAGE_SIZE);
197197

198198
memory_provider.template notify_using<zero_mem>(
199-
(void*)((size_t)p + OS_PAGE_SIZE), size - OS_PAGE_SIZE);
199+
(void*)((size_t)p + OS_PAGE_SIZE),
200+
bits::align_up(size, OS_PAGE_SIZE) - OS_PAGE_SIZE);
200201
}
201202
else
202203
{
203204
// This is a superslab that has not been decommitted.
204205
if (zero_mem == YesZero)
205-
memory_provider.template zero<true>(p, size);
206+
memory_provider.template zero<true>(
207+
p, bits::align_up(size, OS_PAGE_SIZE));
206208
}
207209
}
208210

0 commit comments

Comments
 (0)