| 41 | #if defined(FTL_OS_LINUX) || defined(FTL_OS_MAC) || defined(FTL_iOS) |
| 42 | |
| 43 | void MemoryGuard(void *memory, size_t bytes) { |
| 44 | int result = mprotect(memory, bytes, PROT_NONE); |
| 45 | FTL_ASSERT("mprotect", !result); |
| 46 | # if defined(NDEBUG) |
| 47 | // Void out the result for release, so the compiler doesn't get cranky about an unused variable |
| 48 | (void)result; |
| 49 | # endif |
| 50 | } |
| 51 | |
| 52 | void MemoryGuardRelease(void *memory, size_t bytes) { |
| 53 | int const result = mprotect(memory, bytes, PROT_READ | PROT_WRITE); |