Heaps can suffer from fragmentation if lots of different size memory blocks are requested then freed up and so on. It's usual when a block is freed to add it to a list- called a free list. Future requests for heap memory are first checked against the free list and used instead of allocating it out of the main heap memory. But if a reused block is smaller than the block in the free list then that block is split in two, with a smaller block left in the free list. This fragmentation can eventually lead to applications running out of memory.
One way round this is to use Garbage Collection. The .NET framework has this built in, but developers using C or C++ have to write their own garbage collector or use a 3rd party memory manager.

