microsoft/qdk
Publicmirrored fromhttps://github.com/microsoft/qdkAvailable
allocator/mimalloc-sys/mimalloc/src/prim/prim.c
24lines · modecode
| 1 | /* ---------------------------------------------------------------------------- |
| 2 | Copyright (c) 2018-2023, Microsoft Research, Daan Leijen |
| 3 | This is free software; you can redistribute it and/or modify it under the |
| 4 | terms of the MIT license. A copy of the license can be found in the file |
| 5 | "LICENSE" at the root of this distribution. |
| 6 | -----------------------------------------------------------------------------*/ |
| 7 | |
| 8 | // Select the implementation of the primitives |
| 9 | // depending on the OS. |
| 10 | |
| 11 | #if defined(_WIN32) |
| 12 | #include "windows/prim.c" // VirtualAlloc (Windows) |
| 13 | |
| 14 | #elif defined(__APPLE__) |
| 15 | #include "osx/prim.c" // macOSX (actually defers to mmap in unix/prim.c) |
| 16 | |
| 17 | #elif defined(__wasi__) |
| 18 | #define MI_USE_SBRK |
| 19 | #include "wasi/prim.c" // memory-grow or sbrk (Wasm) |
| 20 | |
| 21 | #else |
| 22 | #include "unix/prim.c" // mmap() (Linux, macOSX, BSD, Illumnos, Haiku, DragonFly, etc.) |
| 23 | |
| 24 | #endif |
| 25 | |