POSIX_COMMIT_CHECKS adding for apple. (#284)

* POSIX_COMMIT_CHECKS adding for apple Intel
This commit is contained in:
David CARLIER
2021-02-23 14:51:02 +00:00
committed by GitHub
parent 70e5f9653d
commit c082a331e2

View File

@@ -52,6 +52,7 @@ namespace snmalloc
::bzero(p, size);
}
# if defined(PLATFORM_IS_ARM)
/**
* Overriding here to mark the page as reusable
* rolling it as much as necessary.
@@ -63,6 +64,9 @@ namespace snmalloc
static void notify_not_using(void* p, size_t size) noexcept
{
SNMALLOC_ASSERT(is_aligned_block<PALBSD::page_size>(p, size));
# ifdef USE_POSIX_COMMIT_CHECKS
memset(p, 0x5a, size);
# endif
while (madvise(p, size, MADV_FREE_REUSABLE) == -1 && errno == EAGAIN)
;
}
@@ -82,6 +86,7 @@ namespace snmalloc
if constexpr (zero_mem == YesZero)
zero<true>(p, size);
}
# endif
};
} // namespace snmalloc
#endif