Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: How much memory take a simple sfml app  (Read 3762 times)

0 Members and 2 Guests are viewing this topic.

ne

  • Newbie
  • *
  • Posts: 1
    • View Profile
How much memory take a simple sfml app
« 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?

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: How much memory take a simple sfml app
« Reply #1 on: February 01, 2014, 12:35:56 am »
And how would you be measuring memory usage?
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

eigenbom

  • Full Member
  • ***
  • Posts: 228
    • View Profile
Re: How much memory take a simple sfml app
« Reply #2 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.

dabbertorres

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
    • website/blog
Re: How much memory take a simple sfml app
« Reply #3 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

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
AW: How much memory take a simple sfml app
« Reply #4 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. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Assassin0795

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: AW: How much memory take a simple sfml app
« Reply #5 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