But that is a flaw in the programs memory design, isn't it? After all, only the program logic is responsible for storing data on the heap. If the allocator(s) don't organize the given data according to their lifetime, then you end up with fragmentation. But given that a test run has a known lifetime, it should be very well possible to organize the allocations serving that specific test run appropriately.