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

Author Topic: High memory usage of SFML applications  (Read 13298 times)

0 Members and 1 Guest are viewing this topic.

K-Bal

  • Full Member
  • ***
  • Posts: 104
    • View Profile
    • pencilcase.bandcamp.com
    • Email
High memory usage of SFML applications
« on: April 09, 2009, 02:35:19 pm »
Hey there,

I recognized that my SFML applications under Ubuntu use at least 40 megs of RAM. Even if I just open a RenderWindow and do nothing else but running the game loop.

I don't know if that is normal, but I guess that could be optimized.

I'm using 1.5 from the SVN.

Cheers,
Marius
Listen to my band: pencilcase.bandcamp.com

Astrof

  • Full Member
  • ***
  • Posts: 135
    • View Profile
High memory usage of SFML applications
« Reply #1 on: April 09, 2009, 03:41:07 pm »
SFML doesn't sleep unless you tell it to (or UseVerticalSync() or SetFramrateLimit() ) using sf::Sleep()

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
High memory usage of SFML applications
« Reply #2 on: April 09, 2009, 04:12:31 pm »
He's not speaking about CPU but RAM.  :wink:

That's odd, one of my application only need 5 MB of writable memory.
But its virtual memory is 34.3 MB.

Which kind of memory do you speak ?
SFML / OS X developer

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
High memory usage of SFML applications
« Reply #3 on: April 09, 2009, 04:44:20 pm »
Is it a fixed amount, or is it growing? Is it happening with other modules (network, audio)?
Laurent Gomila - SFML developer

K-Bal

  • Full Member
  • ***
  • Posts: 104
    • View Profile
    • pencilcase.bandcamp.com
    • Email
High memory usage of SFML applications
« Reply #4 on: April 10, 2009, 02:20:54 am »
The amount of memory usage ist relatively constant at about 40 megs with a minimal application:

Creating a RenderWindow and running the game loop.

I didn't test this on Windows, I'm using Ubuntu 8.10.
Listen to my band: pencilcase.bandcamp.com

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
High memory usage of SFML applications
« Reply #5 on: April 10, 2009, 11:24:15 am »
What about other modules?
Laurent Gomila - SFML developer

K-Bal

  • Full Member
  • ***
  • Posts: 104
    • View Profile
    • pencilcase.bandcamp.com
    • Email
High memory usage of SFML applications
« Reply #6 on: April 10, 2009, 02:40:11 pm »
Quote from: "Laurent"
What about other modules?


I'll might check that out, if I have the time. At the moment I'm using my spare time for the SFML community contest of the german forum ;)

Next week, I'm back home, where I also have a Windows XP machine to test on.
Listen to my band: pencilcase.bandcamp.com

K-Bal

  • Full Member
  • ***
  • Posts: 104
    • View Profile
    • pencilcase.bandcamp.com
    • Email
High memory usage of SFML applications
« Reply #7 on: April 11, 2009, 11:10:48 am »
The first thing I had time to check for was the difference between debug and release version.

The result: they both use about the same amount of RAM.
Listen to my band: pencilcase.bandcamp.com

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
High memory usage of SFML applications
« Reply #8 on: April 12, 2009, 01:24:00 pm »
Sounds weird that it takes that much memory? It could be that SFML uses Xlib pixelbuffs(I think they were called that) too much?
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
High memory usage of SFML applications
« Reply #9 on: April 12, 2009, 07:23:36 pm »
SFML doesn't use pixelbuffs (I don't even know what it is).
Laurent Gomila - SFML developer

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
High memory usage of SFML applications
« Reply #10 on: April 12, 2009, 11:53:18 pm »
I don't remember the correct name for the structure but it's Pixel... something. Anyway It's like Xlib's "Images" and is used to transfer image data from the client(application) to the server(display). Instead of sending the image all the time, it just passed the id of the image and the server knows what image it's talking about. Something like that.

You know the X-protocol was supposed to work over networks too :P


** EDIT **
It might be "Pixmaps". I searched quickly on the web and stumbled upon that name
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
High memory usage of SFML applications
« Reply #11 on: April 12, 2009, 11:59:37 pm »
Xlib is used only for windowing, SFML doesn't use it at all for graphics. Only OpenGL is used.
Laurent Gomila - SFML developer

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
High memory usage of SFML applications
« Reply #12 on: April 13, 2009, 12:02:27 am »
Hmm ah then I'm lost. I haven't looked at glx at all so I don't know how it works.

Maybe is so that X server needs that much memory for an OpenGL Rendering context?
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

JSLemming

  • Newbie
  • *
  • Posts: 7
    • View Profile
High memory usage of SFML applications
« Reply #13 on: April 13, 2009, 04:40:17 am »
I'm running Ubuntu 8.10 also and all of the sample programs I've tried average about 9.5 MiB.

EDIT: I'm using 1.5 from the SVN as well.

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
High memory usage of SFML applications
« Reply #14 on: April 13, 2009, 09:13:37 am »
K-Bal, do you use option '-s' or '-Os' at compiling time ?
(I do.)
SFML / OS X developer