Reapply r99881 with some fixes: only call destructor in releaseMemory!