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

Author Topic: resources  (Read 2349 times)

0 Members and 1 Guest are viewing this topic.

mihaineken

  • Newbie
  • *
  • Posts: 30
    • View Profile
    • Email
resources
« on: July 28, 2013, 08:23:18 pm »
why the programas whrited in SFML consume lots of resources?
for example even a symple window consumes 40% RAM (I have 4GB).

Lo-X

  • Hero Member
  • *****
  • Posts: 618
    • View Profile
    • My personal website, with CV, portfolio and projects
Re: resources
« Reply #1 on: July 28, 2013, 08:29:47 pm »
What do you do in your code ?

I just launched a window and code that contains about 50 shapes and it took 0.2-0.3% of 6Gio RAM. (Linux @Ubunu)

The Terminator

  • Full Member
  • ***
  • Posts: 224
  • Windows and Mac C++ Developer
    • View Profile
Re: resources
« Reply #2 on: July 28, 2013, 09:22:44 pm »
Well, sf::Texture is a pretty heavy class, but I doubt it would consume that much RAM unless you were attempting to create and draw thousands of them.
Current Projects:
Technoport

Ancurio

  • Jr. Member
  • **
  • Posts: 66
    • View Profile
Re: resources
« Reply #3 on: July 29, 2013, 12:27:27 pm »
Well, sf::Texture is a pretty heavy class, but I doubt it would consume that much RAM unless you were attempting to create and draw thousands of them.

Actually, sf::Texture is not heavy not the RAM at all, since textures are stored in VRAM.

mihaineken

  • Newbie
  • *
  • Posts: 30
    • View Profile
    • Email
Re: resources
« Reply #4 on: July 29, 2013, 07:04:01 pm »
I'm so sorry
I was totaly wrong.
I was thinking at somethig else when I was whriting the post.
It's not ram that is consuming, is CPU even with the smallest code that open a window.

mihaineken

  • Newbie
  • *
  • Posts: 30
    • View Profile
    • Email
Re: resources
« Reply #5 on: July 29, 2013, 07:11:52 pm »
I'm using windows and whrite the code in code::blocks using sfml 2.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: resources
« Reply #6 on: July 29, 2013, 07:13:28 pm »
If you don't do anything, a CPU core will execute the loop at its full capacity.

To reduce CPU load, you have three possibilities, of which I recommend the third:
  • sf::RenderWindow::setFramerateLimit()
  • sf::sleep() -- manual approach for the framerate limit
  • sf::RenderWindow::setVerticalSyncEnabled()
By the way, you can edit your post if you have something to add.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

mihaineken

  • Newbie
  • *
  • Posts: 30
    • View Profile
    • Email
Re: resources
« Reply #7 on: July 29, 2013, 08:37:29 pm »
yes... I look so silly, like... almost all the time...
thank you very much, you are such a nice people...