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

Author Topic: Memory consumption?  (Read 2190 times)

0 Members and 1 Guest are viewing this topic.

snfmlnoob

  • Newbie
  • *
  • Posts: 2
    • View Profile
Memory consumption?
« on: August 20, 2011, 07:32:55 am »
Hello! I was looking at sdl, when someone mentioned SFML. And i liked it very much!
Just one problem...
Code: [Select]
#include <SFML/Graphics.hpp>

int main(int argc, char* argv[]) {
  sf::RenderWindow window(sf::VideoMode(800, 600, 32), "SFML Window");
  sf::Event Event;
  while (window.IsOpened()) {
    while (window.PollEvent(Event)) {
      if (Event.Type == sf::Event::Closed)
window.Close();
    }
    window.Clear();
    window.Display();
  }
  return 0;
}

This simple code + SFML2 from git + Linux + compiled with gcc 4.5.3 -O2 = 37mb RAM eaten. Is it normal? :shock: My computer has only 1GB RAM,  4% for a program that does absolutely nothing is a bit too much...
top:
Code: [Select]
 PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
18468 player    20   0 56132  37m 6172 R 80.7  3.7   0:10.23 projectG


---- Edit ----
Did pmap just now. Freaking ati drivers eat 29 mb. :evil: That means this is not SFML problem?
Btw, i've noticed Xinerama and Randr libs loaded, though i don't use them... Is it intended?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Memory consumption?
« Reply #1 on: August 20, 2011, 09:23:21 am »
You can run a simple OpenGL program, like glxgears, and compare the memory consumption.

I don't know what Xinerama is, but Randr is used internally by SFML.
Laurent Gomila - SFML developer

snfmlnoob

  • Newbie
  • *
  • Posts: 2
    • View Profile
Memory consumption?
« Reply #2 on: August 20, 2011, 02:18:34 pm »
Yeah... Tried glxgears - 35mb. And 29 of that is fglrx_dri.so. Any program that uses 3d instantly loads that library. Well... it can't be helped. :(

From wikipedia:
Quote
Xinerama is an extension to the X Window System which enables multi-headed X applications and window managers to use two or more physical displays

I'm using one display. Seems like this is driver's problem, too. Everything that loads fglrx_dri also loads libXinerama.