Commit c597538b authored by Max Kellermann's avatar Max Kellermann

util/HugeAllocator: implement on Windows

parent 43f964e2
......@@ -63,6 +63,28 @@ HugeFree(void *p, size_t size);
void
HugeDiscard(void *p, size_t size);
#elif defined(WIN32)
#include <windows.h>
gcc_malloc
static inline void *
HugeAllocate(size_t size)
{
return VirtualAlloc(nullptr, size, MEM_LARGE_PAGES, PAGE_READWRITE);
}
static inline void
HugeFree(void *p, gcc_unused size_t size)
{
VirtualFree(p, 0, MEM_RELEASE);
}
static inline void
HugeDiscard(void *p, size_t size)
{
VirtualAlloc(p, size, MEM_RESET, PAGE_NOACCESS);
}
#else
/* not Linux: fall back to standard C calls */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment