LibGC: Remove awkward USE_FALLBACK_BLOCK_DEALLOCATION path

We can make a new fallback path eventually if needed for some platform.
This commit is contained in:
Andreas Kling 2025-12-18 14:13:20 -06:00 committed by Andreas Kling
parent cb0c428b3a
commit cce3ce2df7

View file

@ -19,10 +19,6 @@
# include <sanitizer/lsan_interface.h>
#endif
#if defined(AK_OS_GNU_HURD) || (!defined(MADV_FREE) && !defined(MADV_DONTNEED))
# define USE_FALLBACK_BLOCK_DEALLOCATION
#endif
#if defined(AK_OS_WINDOWS)
# include <AK/Windows.h>
# include <memoryapi.h>
@ -80,16 +76,6 @@ void BlockAllocator::deallocate_block(void* block)
warnln("{}", Error::from_windows_error(ret));
VERIFY_NOT_REACHED();
}
#elif defined(USE_FALLBACK_BLOCK_DEALLOCATION)
// If we can't use any of the nicer techniques, unmap and remap the block to return the physical pages while keeping the VM.
if (munmap(block, HeapBlock::block_size) < 0) {
perror("munmap");
VERIFY_NOT_REACHED();
}
if (mmap(block, HeapBlock::block_size, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE | MAP_FIXED, -1, 0) != block) {
perror("mmap");
VERIFY_NOT_REACHED();
}
#elif defined(MADV_FREE)
if (madvise(block, HeapBlock::block_size, MADV_FREE) < 0) {
perror("madvise(MADV_FREE)");