1
General / Re: My std::vector just won't free memory (of the textures etc.)
« on: October 21, 2015, 09:50:10 am »
Well, there is the class asteroid in the class planet_system. asteroid had this to handle the texture:
Because the asteroids were stored in an vector inside of planet_system, I could guesss, that maybe the clearing and shrin_to_fit-ing of the planet_system-vector did not affect the asteroid-vector inside it?
class asteroid(sf::Texture & tex_asteroid)
{
sf::Texture &texref = sf::Texture();
//...
}
and this was in the Constructor of asteroid:{
sf::Texture &texref = sf::Texture();
//...
}
texref = tex_asteroid;
I don't know exactly why these pointers caused this kind of problem, but I changed it so that there were no texture opjects or pointers anymore in asteroid and my memory problem disappeared Because the asteroids were stored in an vector inside of planet_system, I could guesss, that maybe the clearing and shrin_to_fit-ing of the planet_system-vector did not affect the asteroid-vector inside it?