SFML community forums

General => General discussions => Topic started by: ne on February 01, 2014, 12:29:19 am

Title: How much memory take a simple sfml app
Post by: ne on February 01, 2014, 12:29:19 am
This simple app
 #include <SFML/Graphics.hpp>
int main()
{

        sf::RenderWindow window{sf::VideoMode::getDesktopMode(), "SFML window"};
        window.setFramerateLimit(60);
       

        while (window.isOpen())
        {
           sf::Event event;
           
           while (window.pollEvent(event))
           {
               if (event.type == sf::Event::Closed)
                   window.close();
           }
           
           window.clear();
           window.display();
        }
       
        return 0;
}
takes 25MiB.
Is this normal?
Title: Re: How much memory take a simple sfml app
Post by: zsbzsb on February 01, 2014, 12:35:56 am
And how would you be measuring memory usage?
Title: Re: How much memory take a simple sfml app
Post by: eigenbom on February 01, 2014, 01:37:58 am
RAM: I get about 25mb, both for debug and release mode. You can probably shrink it down by compiling SFML in a certain way, but 25mb is such a small amount I wouldn't bother. Running Minesweeper on Windows 8 takes 75mb RAM, for example. :)

Disk Size: executable+dlls should only be about 5mb or so in release mode.
Title: Re: How much memory take a simple sfml app
Post by: dabbertorres on February 01, 2014, 02:39:36 am
Yeah, especially with the average computer having 4GB of RAM nowadays, 25 MB is fine.
25 / (4 * 1024) = ~0.6% of total RAM. :P
Title: AW: How much memory take a simple sfml app
Post by: eXpl0it3r on February 01, 2014, 07:35:05 pm
And I bet everyone is look at thd task manager, without knowing that not everything you see there is fully allocated. The system usually assigns more memory to an application that what it actually needs, just in case it would request more and thus would get it alot quicker.
But if another application needs the memory, the system would free the unused memory. ;)
Title: Re: AW: How much memory take a simple sfml app
Post by: Assassin0795 on February 02, 2014, 05:12:55 am
And I bet everyone is look at thd task manager, without knowing that not everything you see there is fully allocated. The system usually assigns more memory to an application that what it actually needs, just in case it would request more and thus would get it alot quicker.
But if another application needs the memory, the system would free the unused memory. ;)

int n;
int m = (n * n);
float *k = malloc(sizeof(float) * (m*m));


...It's a good way to crash programs. Malloc doesn't like uninitialized variables. :D