POSIX_COMMIT_CHECKS adding for apple. (#284)
* POSIX_COMMIT_CHECKS adding for apple Intel
This commit is contained in:
@@ -52,6 +52,7 @@ namespace snmalloc
|
|||||||
::bzero(p, size);
|
::bzero(p, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# if defined(PLATFORM_IS_ARM)
|
||||||
/**
|
/**
|
||||||
* Overriding here to mark the page as reusable
|
* Overriding here to mark the page as reusable
|
||||||
* rolling it as much as necessary.
|
* rolling it as much as necessary.
|
||||||
@@ -63,6 +64,9 @@ namespace snmalloc
|
|||||||
static void notify_not_using(void* p, size_t size) noexcept
|
static void notify_not_using(void* p, size_t size) noexcept
|
||||||
{
|
{
|
||||||
SNMALLOC_ASSERT(is_aligned_block<PALBSD::page_size>(p, size));
|
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)
|
while (madvise(p, size, MADV_FREE_REUSABLE) == -1 && errno == EAGAIN)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
@@ -82,6 +86,7 @@ namespace snmalloc
|
|||||||
if constexpr (zero_mem == YesZero)
|
if constexpr (zero_mem == YesZero)
|
||||||
zero<true>(p, size);
|
zero<true>(p, size);
|
||||||
}
|
}
|
||||||
|
# endif
|
||||||
};
|
};
|
||||||
} // namespace snmalloc
|
} // namespace snmalloc
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user