From c082a331e23899de9327ef75762909929cd1cfee Mon Sep 17 00:00:00 2001 From: David CARLIER Date: Tue, 23 Feb 2021 14:51:02 +0000 Subject: [PATCH] POSIX_COMMIT_CHECKS adding for apple. (#284) * POSIX_COMMIT_CHECKS adding for apple Intel --- src/pal/pal_apple.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/pal/pal_apple.h b/src/pal/pal_apple.h index 5565fed..ad5b473 100644 --- a/src/pal/pal_apple.h +++ b/src/pal/pal_apple.h @@ -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(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(p, size); } +# endif }; } // namespace snmalloc #endif