I am trying to make an algorithm that can draw the objects of my isometric game in the correct order. My objects are stored in a pointer vector.
In the drawing function, I first create a new vector of the same pointers, and then start with a for loop, which loops over the number of objects I want to draw. Inside this loop there is another loop that determines which object should be drawn, and when the object is drawn, its pointer is removed from the vector using vector.erase (), so the same face will not be drawn twice (that's why I'm creating copy of a vector containing pointers to objects).
In any case, my code itself works, and the entities are drawn the way I want, but I seem to have a memory leak (I can see how the memory in Windows Task Manager rises by 28 kb / s).
A memory leak is saved even if I expel everything except this:
vector<Entity*> list = ent_list;
list.clear();
So, I think I'm missing something, but I'm not sure what. I thought that since I had not used the “new”, the memory would have taken care, but obviously it is not ... I hope someone can help me!
/ Theodore
source
share