heap_allocator
                                
                                
                                
                                    heap_allocator copied to clipboard
                            
                            
                            
                        memory chunk cannot be merged when being freed
On line 71 in heap.c of current version, when the node being freed is the start of the heap, we still need to check whether it can be merged with its next chunk. For example:
p = heap_alloc(heap, 100); heap_free(heap, p);
After this 2 lines, the whole heap is still splitted into 2 free chunks, but the 2 free chunks should be merged into 1.