Hey,
i think in your implementation of MergeIfPossible you're missing to merge with all free chunks of memory. Let's say you have a Chunk A (which is free), B (in use), and C (free). After freeing B you'll merge B with C, but miss the oportunity to merge with A.
Unless i'm missing something obvious.