Memory Leak?

Started by
10 comments, last by Jansic 11 years, 9 months ago
Please correct me if I am wrong, but it is to my understanding that "Vector erase iterator out of range" would mean you are passing in a Vector position that is outside that actual size of the vector, meaning that said Vector position doesn't exist?

Also, if you remove "+ emitterNum" from you first removeEmitter function, then you will only be erasing the element at the very beginning of the Vector each time the method is called, which is probably what you don't want/might lead to some particles 'dying' before their life comes to their actual end.

Again, I apologise if any of the information I am providing is incorrect.
Advertisement

Anyway, wouldn't it be easier to just call the clear function to clear all of the elements in the vector? I tried it and I'm not getting the debug assertion.

I suspect the problem is in the calling function - it's probably looping over the length of the array and calling removeEmitter for each index - which won't work correctly because erasing an element from the vector will make it shorter, shifting the other elements up by one..

Jans.

This topic is closed to new replies.

Advertisement