Hello,
Given the minimal code below, at first run, in the Windows' task manager, my application is getting around 7000K memory, and after pressing a key (loading a texture), it takes 9000K. The problem is that memory stays at 9000K forever after, even when i free the texture memory, and reload it. Is this normal?:
#include <SFML/Graphics.hpp>
int main(int argc, char* argv[])
{
sf::RenderWindow window( { 800, 600 }, "Testwindow" );
window.setFramerateLimit( 60 );
sf::Texture* tex{ nullptr };
sf::Sprite sprite;
while( window.isOpen() ) {
sf::Event event;
while( window.pollEvent( event ) ) {
if ( event.type == sf::Event::Closed ) {
window.close();
}
else if ( event.type == sf::Event::KeyReleased ) {
if ( tex ) {
delete tex;
tex = nullptr;
sprite = sf::Sprite();
}
else {
tex = new sf::Texture();
tex->loadFromFile( "test.png" );
sprite.setTexture( *tex );
}
}
}
window.clear();
if ( tex ) {
window.draw( sprite );
}
window.display();
}
if ( tex ) delete tex;
return 0;
}
I'm using SFML2.1. Thanks.