Skip mprotect calls on decommit/commit

This commit is contained in:
Mattias Jansson
2023-10-30 18:10:21 +01:00
parent b1b0ffb833
commit 857a088914

View File

@@ -786,9 +786,11 @@ os_mcommit(void* address, size_t size) {
rpmalloc_assert(0, "Failed to commit virtual memory block");
}
#else
/*
if (mprotect(address, size, PROT_READ | PROT_WRITE)) {
rpmalloc_assert(0, "Failed to commit virtual memory block");
}
*/
#endif
#if ENABLE_STATISTICS
size_t page_count = size / global_config.page_size;
@@ -818,9 +820,11 @@ os_mdecommit(void* address, size_t size) {
rpmalloc_assert(0, "Failed to decommit virtual memory block");
}
#else
/*
if (mprotect(address, size, PROT_NONE)) {
rpmalloc_assert(0, "Failed to decommit virtual memory block");
}
*/
#if defined(MADV_DONTNEED)
if (madvise(address, size, MADV_DONTNEED)) {
#elif defined(MADV_FREE_REUSABLE)