Master the fundamental concepts of memory optimization through this focused micro-challenge.
Repeated allocate/free patterns of different sizes leave unusable gaps between live blocks. Visualizing free holes explains why long-running servers restart or switch to pool allocators even when total bytes look fine.
Map each heap byte to a character: . free, # allocated, | boundary. After a fragmentation script, long runs of . between # clusters show external fragmentation.
cLoading…
Keep the relevant documentation open while you implement. When your output disagrees with the reference, trace one failing case by hand before changing random lines.
You will simulate a simple heap and print colored ASCII maps after a fragmentation workload. This exercise requires identifying a hole that blocks a large allocation request.
Visualize heap fragmentation with colored ASCII art.
Requirements:
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
All starter code and reference implementations are available for your local setup.
View on Github