Now what I'm actually curious about is: Does overwriting objects like this leak memory in any way?
The only time YOU can cause a leak is when you use new without a corresponding delete; That is when you allocate memory on the heap without deallocating it again.
In the code example there's no new so this code cannot cause a leak.
In Vector3 there may be a new so there may be a leak, but it's impossible to know without looking at the implementation. If YOU'VE put in a new in Vector3 without a corresponding delete you've caused it to leak.
Bookmarks