Skip to content

Commit fa1e328

Browse files
devnexenmjp41
authored andcommitted
PAL Haiku update.
with the beta3 release, and realizing MADV_DONTNEED is a "no-op" MADV_FREE however is the only making sure the page range is discarded.
1 parent 3218792 commit fa1e328

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/pal/pal_haiku.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,13 @@ namespace snmalloc
3535
static void notify_not_using(void* p, size_t size) noexcept
3636
{
3737
SNMALLOC_ASSERT(is_aligned_block<page_size>(p, size));
38-
posix_madvise(p, size, POSIX_MADV_DONTNEED);
38+
# ifdef USE_POSIX_COMMIT_CHECKS
39+
memset(p, 0x5a, size);
40+
# endif
41+
madvise(p, size, MADV_FREE);
42+
# ifdef USE_POSIX_COMMIT_CHECKS
43+
mprotect(p, size, PROT_NONE);
44+
# endif
3945
}
4046
};
4147
} // namespace snmalloc

0 commit comments

Comments
 (0)