Skip to content
Tech Atlas, home
Search
Esc
  • All roadmapsBrowse every learning path
  • ExploreFind a technology area
  • ProjectsGuided projects and builds
  • My AtlasYour learning dashboard
Skill

Memory Allocators & Leaks

Explain how user-space and kernel allocators hand out memory, and tell a leak from fragmentation, caching or slab growth when a process's memory keeps rising.

Advanced1 roadmap

3 objectives 5 steps about 110 min

Check what you know

The lessons are coming later. The knowledge check is ready now.

Take the knowledge check

This skill page is a public outline. Its lessons and knowledge check appear here as subject-matter experts approve them.

Learning objectives

  • Explain how a C allocator obtains memory from the kernel with brk and mmap, manages free lists, size classes and per-thread arenas, and why freed memory is often not returned to the operating system.
  • Explain internal and external fragmentation and how the kernel's buddy and slab allocators manage physical memory, and read /proc/buddyinfo, slabtop and transparent huge page counters.
  • Determine whether rising memory use is a leak, allocator fragmentation, a cache or kernel slab growth using heap profilers (heaptrack or Valgrind massif), /proc/<pid>/smaps and allocator statistics, and confirm a fix with a before-and-after measurement.

Lesson plan

5 steps, about 110 min · 0 of 4 lessons available so far

  1. From malloc to the kernel: brk, mmap, free lists, size classes and arenas Concept · 20 min · coming later
  2. Worked example: a tiny free-list allocator and the fragmentation it creates Worked example · 25 min · coming later
  3. The kernel's allocators: buddy system, slab caches and huge pages Concept · 20 min · coming later
  4. Lab: a service whose memory keeps growing - leak, fragmentation or cache? Lab · 30 min · coming later
  5. Check: explain three memory-growth reports Knowledge check · 6 questions

Practise it

Run a provided C service under three seeded faults (a real leak, fragmentation from mixed allocation sizes across threads, and an unbounded in-process cache). For each, collect smaps_rollup over time, a heaptrack or massif profile and malloc_info or allocator statistics, classify the cause, apply a fix or allocator setting (for example MALLOC_ARENA_MAX or jemalloc), and submit before-and-after RSS graphs with an explanation of what the measurements cannot rule out.

References

Hard prerequisites

Unlocks

Nothing depends on this skill yet.

On these roadmaps

Progress and evidence for this skill are shared across all of them.