Commit graph

7 commits

Author SHA1 Message Date
Andreas Kling
5af4bc81e1 LibGC: Use mach_vm_map() for BlockAllocator on macOS
This allows us to get a correctly aligned allocation with a single
syscall, unlike posix_memalign() which makes no such guarantees.
2025-12-19 20:21:07 -06:00
Andreas Kling
82f63334d0 LibGC: Use MADV_FREE_REUSABLE and MADV_FREE_REUSE if available
These are macOS madvise() hints that keep the kernel accounting aware of
how we're using the GC memory. This keeps our memory footprint looking
more accurate.
2025-12-19 20:21:07 -06:00
Andreas Kling
716e5f72f2 LibGC: Always use 16 KiB as HeapBlock size
Before this change, we'd use the system page size as the HeapBlock
size. This caused it to vary on different platforms, going as low
as 4 KiB on most Linux systems.

To make this work, we now use posix_memalign() to ensure we get
size-aligned allocations on every platform.

Also nice: HeapBlock::BLOCK_SIZE is now a constant.
2025-12-19 20:21:07 -06:00
Andreas Kling
cce3ce2df7 LibGC: Remove awkward USE_FALLBACK_BLOCK_DEALLOCATION path
We can make a new fallback path eventually if needed for some platform.
2025-12-19 20:21:07 -06:00
R-Goc
0de3a95433 LibGC: Pass correct args to VirtualFree
VirtualFree expects zero to be passed as size for MEM_RELEASE.
2025-06-05 22:00:55 -06:00
R-Goc
d5cb940fe0 LibGC: Use native windows allocation methods for GC blocks
This allows us to use DiscardVirtualMemory in the same way that we
use madvise with MADV_DONTNEED and MADV_FREE on Unix systems.
2025-05-29 03:26:23 -06:00
Shannon Booth
f87041bf3a LibGC+Everywhere: Factor out a LibGC from LibJS
Resulting in a massive rename across almost everywhere! Alongside the
namespace change, we now have the following names:

 * JS::NonnullGCPtr -> GC::Ref
 * JS::GCPtr -> GC::Ptr
 * JS::HeapFunction -> GC::Function
 * JS::CellImpl -> GC::Cell
 * JS::Handle -> GC::Root
2024-11-15 14:49:20 +01:00
Renamed from Libraries/LibJS/Heap/BlockAllocator.cpp (Browse further)