Oliver Sander
authored
This method only frees the HEAP memory if the internal heap is used. When using the system heap, however, the HEAP data structure contains a C-array of std::vectors, created by placement new. Hence, before freeing the memory, those vectors need to have their destructors called. Otherwise, their memory will leak.