diff options
Diffstat (limited to 'src/lib/stdlib.C')
-rw-r--r-- | src/lib/stdlib.C | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lib/stdlib.C b/src/lib/stdlib.C index 1614bdd8f..ab509ca9a 100644 --- a/src/lib/stdlib.C +++ b/src/lib/stdlib.C @@ -7,7 +7,8 @@ void* malloc(size_t s) { if (s > HeapManager::MAX_ALLOC_SIZE) { - size_t pages = (s+8) / PageManager::PAGESIZE; + size_t pages = (s + 8 + (PageManager::PAGESIZE - 1)) + / PageManager::PAGESIZE; void* v = PageManager::allocatePage(pages); size_t* len = (size_t*)v; *len = pages << 8; |