MCPcopy Create free account
hub / github.com/RichieSams/FiberTaskingLib / MemoryGuard

Function MemoryGuard

source/alloc.cpp:43–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41#if defined(FTL_OS_LINUX) || defined(FTL_OS_MAC) || defined(FTL_iOS)
42
43void 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
52void MemoryGuardRelease(void *memory, size_t bytes) {
53 int const result = mprotect(memory, bytes, PROT_READ | PROT_WRITE);

Callers 1

FiberMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected