
Coalescing - Phase 5 Mini Malloc
This is the fifth phase of malloc. Here, I have implemented block coalescing. This was very interesting and a fun phase. Block coalescing helps in reusing memory Note : The clues and guidance I mention below were given to me by an AI assistant, used purely to guide my understanding of concepts and syntax. The entire code is written by me, referencing the official glibc documentation throughout. I'm mentioning this explicitly because I believe in being honest about the learning process. The entire process and my code has been uploaded on my github account: [ https://github.com/moonlitpath1/mini-malloc ] Clues: This is the most intellectually satisfying phase. You're about to fix the opposite problem — **external fragmentation : adjacent free blocks that could be one big block but aren't. [meta|FREE 64][meta|FREE 128][meta|USED 32] If someone asks for malloc(100) — your find_free_block skips both free blocks since neither is ≥ 100 alone. But together they're 192 bytes. Coalescing **merge
Continue reading on Dev.to
Opens in a new tab



