An homemade simulation of heap memory management to better understand it. The 'game mode' is more reliable, you can arbitrary allocate a new memory or free existing chunks in order to see how they react. A better approach could use linked lists, but I didn't.
!bad code inside! (I was understanding CPP while coding this)
git clone https://github.com/kiks7/heappy.git
cd heappy
g++ main.cpp Heap.cpp -o heappy
./heappy
or oneline
git clone https://github.com/kiks7/heappy.git && cd heappy && g++ main.cpp Heap.cpp -o heappy && ./heappy
Tested on Ubuntu x64.