This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Significant execution time (16%)Significant execution time (16%) Memory performance not uniformMemory performance not uniform Allocation policiesAllocation policies BugsBugs
When do we go ahead and split free blocks?When do we go ahead and split free blocks? How much internal fragmentation are we willing How much internal fragmentation are we willing
to tolerate?to tolerate? Coalescing policy:Coalescing policy:
Immediate coalescing: coalesce adjacent blocks Immediate coalescing: coalesce adjacent blocks each time free is called each time free is called
Deferred coalescing: try to improve Deferred coalescing: try to improve performance of free by deferring coalescing performance of free by deferring coalescing until needed. e.g.,until needed. e.g.,
Lea AllocatorLea Allocator An approximate best-fit allocator with An approximate best-fit allocator with
different behavior based on object sizedifferent behavior based on object size Small Objects (<64 bytes) allocated by exact-Small Objects (<64 bytes) allocated by exact-
size quicklistssize quicklists Medium Objects (<128K) – Medium Objects (<128K) – coalesce coalesce quicklistsquicklists Large Objects – allocate and free by Large Objects – allocate and free by mmapmmap
Generally considered the best allocator Generally considered the best allocator known (as of 2000, anyway)known (as of 2000, anyway)
The Two-Phase AbstractionThe Two-Phase Abstraction
1. Detection1. Detection
2. Reclamation2. Reclamation
Liveness and Garbage Liveness and Garbage
There is a root set which is defined There is a root set which is defined as live.as live.
Anything reachable from a live Anything reachable from a live pointer is also livepointer is also live
Everything else is garbageEverything else is garbage
The Root SetThe Root Set
The Root SetThe Root Set Static global and module variablesStatic global and module variables Local VariablesLocal Variables Variables on any activation stack(s)Variables on any activation stack(s)
Everyone elseEveryone else Anything Reachable From a live valueAnything Reachable From a live value
Reference Counting Reference Counting
Each allocated chunk has reference Each allocated chunk has reference count that shows how many locations count that shows how many locations point (refer) to this one.point (refer) to this one.
Starting from the root set traverse all Starting from the root set traverse all pointers via depth/breadth first pointers via depth/breadth first search.search.
Free everything that is not marked.Free everything that is not marked.
More Information/DetailMore Information/Detail
If you wish to know more:If you wish to know more: