aboutsummaryrefslogtreecommitdiff
path: root/src/un_mem_win_x64.c
blob: 91f838fadcd4e414c068470fcbd4149b42662492 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <windows.h>

static ALLOCATOR_PROC_SIGNATURE(un_std_alloc_proc) {
    UNUSED(data);

    switch (message) {
        case UN_ALLOC_MSG_ALLOCATE:
            return VirtualAlloc(NULL, (SIZE_T)size, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE);
        case UN_ALLOC_MSG_FREE:
            if (!VirtualFree(p, 0, MEM_RELEASE)) {
                assert(false);
            }
            break;
        case UN_ALLOC_MSG_SELF_DELETE: break;
    }

    return NULL;
}