Memory Management
Memory management is like, important https://en.wikipedia.org/wiki/Memory_management
Stack
https://en.wikipedia.org/wiki/Stack-based_memory_allocation
alloca
Malloc
Pools
https://en.wikipedia.org/wiki/Memory_pool
Object pools
Thread pools
Fixed size block allocation
Can use Vec<Foo>
push and pop to free
Regions
https://en.wikipedia.org/wiki/Region-based_memory_management
Arenas? Deallocate all at once. Good for fragmentation too. https://manishearth.github.io/blog/2021/03/15/arenas-in-rust/
Garbage Collection
garbage colleciton handbook 2 semi space collector
Immix: A Mark-Region Garbage Collector with Space Efficiency, Fast Collection, and Mutator Performance Conservative Moving
generational
bump pointers
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
DangZero: Efficient Use-After-Free Detection via Direct Page Table Access
Untangling Lifetimes: The Arena Allocator
Garbage Collection Handbook
Control Theory and Concurrent Garbage Collection https://speakerdeck.com/madhavjivrajani/control-theory-and-concurrent-garbage-collection-a-deep-dive-into-the-go-gc-pacer
automemcpy: A Framework for Automatic Generation of Fundamental Memory Operations
https://github.com/mflatt/gc-demo https://www.youtube.com/playlist?list=PLbdXd8eufjyVCrWF-obj8_BbyU5vEF8Jw
treadmill gabrage collector of baker http://www.cofault.com/2022/07/treadmill.html
garbage collection handbook lua wiki
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
bump allocation
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
Parallel
Concurrent
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.
Generational
Making a simple garbage collector https://maplant.com/gc.html