purge memory if munmap fails

pull/138/head
Daniel Micay 2021-05-12 01:05:39 -04:00
parent f9a8e7216b
commit 440489af67
1 changed files with 3 additions and 1 deletions

View File

@ -86,5 +86,7 @@ void *allocate_pages_aligned(size_t usable_size, size_t alignment, size_t guard_
}
void deallocate_pages(void *usable, size_t usable_size, size_t guard_size) {
memory_unmap((char *)usable - guard_size, usable_size + guard_size * 2);
if (unlikely(memory_unmap((char *)usable - guard_size, usable_size + guard_size * 2))) {
memory_purge(usable, usable_size);
}
}