| 110 | } |
| 111 | |
| 112 | WASMEDGE_EXPORT void Allocator::release(uint8_t *Pointer, uint64_t) noexcept { |
| 113 | #if WASMEDGE_OS_WINDOWS |
| 114 | winapi::VirtualFree(Pointer - k4G, 0, winapi::MEM_RELEASE_); |
| 115 | #elif defined(HAVE_MMAP) && (defined(__x86_64__) || defined(__aarch64__) || \ |
| 116 | (defined(__riscv) && __riscv_xlen == 64)) || \ |
| 117 | defined(__s390x__) |
| 118 | if (Pointer == nullptr) { |
| 119 | return; |
| 120 | } |
| 121 | munmap(Pointer - k4G, k12G); |
| 122 | #else |
| 123 | return std::free(Pointer); |
| 124 | #endif |
| 125 | } |
| 126 | |
| 127 | uint8_t *Allocator::allocate_chunk(uint64_t Size) noexcept { |
| 128 | #if WASMEDGE_OS_WINDOWS |