Correctly released all heap memory