diff options
author | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2015-04-21 21:27:44 -0700 |
---|---|---|
committer | Arseny Kapoulkine <arseny.kapoulkine@gmail.com> | 2015-04-21 21:27:44 -0700 |
commit | f9983ea2ed47811ad5a7e41b816642615cbd674f (patch) | |
tree | c20551f1a314ee5776680d9171388cfa5f8bd95a /tests/allocator.cpp | |
parent | cb786665d44598cbaff721e50d6a56b7538789e5 (diff) | |
parent | a6cc636a6b0d531686311b5666ea77225b10903e (diff) |
Merge branch 'master' into compact
Diffstat (limited to 'tests/allocator.cpp')
-rw-r--r-- | tests/allocator.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/allocator.cpp b/tests/allocator.cpp index 8ca0963..e1d99d5 100644 --- a/tests/allocator.cpp +++ b/tests/allocator.cpp @@ -2,6 +2,7 @@ #include <string.h> #include <assert.h> +#include <stdlib.h> // Low-level allocation functions #if defined(_WIN32) || defined(_WIN64) @@ -80,7 +81,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) @@ -111,8 +114,6 @@ namespace } } #else -# include <stdlib.h> - namespace { void* allocate(size_t size) |