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

Author Topic: Allocated Size of sf::RenderWindow  (Read 3311 times)

0 Members and 1 Guest are viewing this topic.

Cyrana

  • Newbie
  • *
  • Posts: 21
    • View Profile
Allocated Size of sf::RenderWindow
« on: September 01, 2016, 11:41:33 am »
I was profiling my allocations and tracked about 66mb down to sf::RenderWindow construction. I used break points for this.
While the heap says, it is only 520 bytes big, this is quite contradicting to me.

Does this sound wrong? Where is the rest being allocated on?

I could not find example sizes of SFML classes, they might vary from OS to OS anyway.
66mb seems a lot to me, I might just have a wrong idea of it.

Additional information:
This happened on debug and release build using /O2
Using Visual Studio 2015 and its profiler
Windows 7
SFML 2.3.2
« Last Edit: September 01, 2016, 12:27:38 pm by Cyrana »

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Allocated Size of sf::RenderWindow
« Reply #1 on: September 01, 2016, 11:44:38 am »
I suppose the first question should be: is this a debug or release build?
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Cyrana

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: Allocated Size of sf::RenderWindow
« Reply #2 on: September 01, 2016, 11:51:14 am »
The both mentioned sizes were on a debug build.

Same behaviour on release build, using /O2 optimization.

Updated the starting post for further missing specs : )
« Last Edit: September 01, 2016, 11:55:30 am by Cyrana »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
AW: Allocated Size of sf::RenderWindow
« Reply #3 on: September 01, 2016, 12:46:17 pm »
Do you have a system the requires a tight memory usage or is this just a personal annoyance?
I mean, I have no idea how much SFML's RenderWindow should allocate, but then again I don't really see a problem with it allocating 60+MB either.

Can you provide the output log of whatever tool you used?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Cyrana

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: Allocated Size of sf::RenderWindow
« Reply #4 on: September 01, 2016, 01:06:47 pm »
Well, I just hit a milestone in my project and looked at the RAM usage. It was a bit high for what it does (around 90mb). Also keeping it low for Android.
Therefore, I started profiling. I found out, that once the RenderWindow is being allocated, 60 of these are just gone.

To be exact:
rendering_window = (std::make_unique<sf::RenderWindow>(window_mode, title_bar_text));

There is not much I could provide you with, the profiler's graph just shows the attached information.
By exact hovering, it displays: 65.7mb. The snapshot was taken after the allocation, during the break point.

The data is not found on the heap. The heap only owns 20mb, only having a small instance of 520 bytes as sf::RenderWindow.

« Last Edit: September 01, 2016, 01:21:51 pm by Cyrana »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Allocated Size of sf::RenderWindow
« Reply #5 on: September 01, 2016, 01:45:36 pm »
I assume you are aware however that Windows RAM usage isn't really comparable to Android RAM usage, right? ;)

I've quickly ran the most basic SFML application, compiled with MinGW GCC 6.1.0, linked SFML and the runtime lib statically and I ended up with Windows task manager (which is obviously not a good measurement tool) showing pretty much 30MB of memory usage.

Not sure if Visual Studio is adding more (unnecessary) things to it?

#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode(800, 600), "Test");

    while(window.isOpen())
    {
        sf::Event event;
        while(window.pollEvent(event))
        {
            if(event.type == sf::Event::Closed)
                window.close();
        }
    }
}
 
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Cyrana

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: Allocated Size of sf::RenderWindow
« Reply #6 on: September 01, 2016, 02:11:49 pm »
Yeah, I know it's not comparable. But I worried about possible memory leaks and unnecessary allocations and whatnot. It just ended up that sf::RenderVideo was allocating a lot, now I wanted to find out if that is my fault.

Thanks for your effort, eXpl0it3r : )
I tried your code, debug build (SFML 2.3.1, statically linked).

Task-Manager: 52mb
Visual Studio profiler: 64.8mb

Which confuses me already, but well.
This rather odd in general. I could not imagine what Visual Studio would add.


Raincode

  • Full Member
  • ***
  • Posts: 118
    • View Profile
Re: Allocated Size of sf::RenderWindow
« Reply #7 on: September 01, 2016, 05:43:18 pm »
Using eXpl0it3r's Code (static linking) and nuwen-6.1 MinGW distro O2 gave me 8,5MB in TaskManager. In case you are interested in more data.

 

anything