Hasty Briefsbeta

Bilingual

Memory Allocation (2023)

2 days ago
  • #malloc-free
  • #memory-allocation
  • #fragmentation
  • Programs require memory allocation to load and store data during execution.
  • Memory allocators manage memory efficiently through functions like malloc and free.
  • Memory is a sequence of bytes, with addresses identifying specific locations.
  • Simple allocators may cause memory leaks if free is not implemented.
  • General-purpose allocators use allocation and free lists to track memory.
  • Fragmentation occurs when free memory is split, preventing larger allocations.
  • Techniques like coalescing, overallocation, and slab allocators reduce fragmentation.
  • Boundary tag allocators store bookkeeping information inline with memory blocks.
  • Memory safety is crucial to avoid bugs like buffer overruns or use-after-free.
  • Allocator playgrounds allow experimentation with implementing malloc and free.