Memory management is like, important https://en.wikipedia.org/wiki/Memory_management
Fixed size block allocation
push and pop to free
Arenas? Deallocate all at once. Good for fragmentation too. https://manishearth.github.io/blog/2021/03/15/arenas-in-rust/
https://dl.acm.org/doi/pdf/10.1145/3519939.3523443 fearless concurrency. domination rather than unique ownershp
Mads Tofte and Jean-Pierre Talpin. 1997. Region-Based Memory Management.
There is a chapter in Pierce ATAPL
e1 at r puts values e1 in region r
letregion r in e creates new region
A stack of regions. They can have compile time fixed size or variable size (linked list of pages)
Basically local bump pointer guys.
With raw pointers you could alloc
int region; region_desc reg; reg.fresh = 0; reg.mem = region on the stack and that would kind of work similarly. It is arenas. But having parameters
https://gist.github.com/AndrasKovacs/fc9e20b0976b7e236b5899fde8f5c95d andras kovacs ideas
Mark and Sweep
Boehm garbage collector
https://twitter.com/sickeningsprawl/status/1560817828411936770?s=20&t=5ByjIVPCy80__MKWdWW1Aw liballocs. Garbage collector that looks at dwarf data. Asiprataional?
malloc and free are bad apis store unnecessary metadata, waste space
Garbage Collection Handbook
real-time concurrent copying vs non-copying. Copying needs to adjust pointers. Can defragment incremental - does the garbage collection need to happen all at once
Conservative vs Exact
The boehm garbage collector seems easy to use. Also you can just malloc and never free. https://en.wikipedia.org/wiki/Boehm_garbage_collector
mark and Sweep
colors mark finished, seen but children not finished. white is unseen. black is swept. When finished anything white is no longer in use.
Making a simple garbage collector https://maplant.com/gc.html