tests: Use malloc for OSX/Linux page heap
Switch to malloc and manually aligning the pointer to the page boundary. mmap is much slower than malloc; this change makes tests ~4x faster.
This commit is contained in:
parent
8c8940430a
commit
bb3aee447b
@ -80,7 +80,9 @@ namespace
|
||||
|
||||
void* allocate_page_aligned(size_t size)
|
||||
{
|
||||
return mmap(0, size + page_size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0);
|
||||
void* result = malloc(size + page_size);
|
||||
|
||||
return reinterpret_cast<void*>(align_to_page(reinterpret_cast<size_t>(result)));
|
||||
}
|
||||
|
||||
void* allocate(size_t size)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user