Closed SneakyFernando closed 6 years ago
You need to free what you malloc, but when you call new Box2D.b2Vec2
it calls a c++ constructor, which you need to run the right destructor for. See here, the syntax is Ammo.destroy(object)
.
@kripken, thanks for the accurate answer and provided link!
I am trying to figure out how to free vectors.
Currently when I run this, I would get memory leak eventually. Debugging shows that ptr1 and ptr2 are equal. I expect ptr2 to have -8 offset. What am I doing wrong?