void Player::draw(sf::RenderTarget& target, sf::RenderStates states) const
{
sf::CircleShape c0;
c0.setFillColor(sf::Color::Red);
c0.setPointCount(4);
c0.setRadius(1);
c0.setPosition(sf::Vector2f(point[0].x, point[0].y));
sf::CircleShape c1;
c1.setFillColor(sf::Color::Red);
c1.setPointCount(4);
c1.setRadius(1);
c1.setPosition(sf::Vector2f(point[1].x, point[1].y));
target.draw(c0);
target.draw(c1);
}
I am learning c++. As you can see I am making the CircleShape objects inside the draw method which runs at 60 times in a second. I read online that objects in c++ are stored in heap memory therefore require manual deallocation. Do the objects c0 and c1 get destroyed and the memory frees when draw method returns, or will they continue to eat heap memory ?