Workaround for QEMU behaviour. (#147)
* Fixes for ARM * Workaround for QEMU behaviour.
This commit is contained in:
committed by
GitHub
parent
a6d6eecf22
commit
4246d9a065
@@ -37,12 +37,16 @@ namespace snmalloc
|
||||
template<bool page_aligned = false>
|
||||
void zero(void* p, size_t size) noexcept
|
||||
{
|
||||
// QEMU does not seem to be giving the desired behaviour for MADV_DONTNEED.
|
||||
// switch back to memset only for QEMU.
|
||||
# ifndef SNMALLOC_QEMU_WORKAROUND
|
||||
if (page_aligned || is_aligned_block<OS_PAGE_SIZE>(p, size))
|
||||
{
|
||||
SNMALLOC_ASSERT(is_aligned_block<OS_PAGE_SIZE>(p, size));
|
||||
madvise(p, size, MADV_DONTNEED);
|
||||
}
|
||||
else
|
||||
# endif
|
||||
{
|
||||
::memset(p, 0, size);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user