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

Author Topic: [SFML 2.0] RenderTexture memory usage  (Read 2298 times)

0 Members and 1 Guest are viewing this topic.

Grain

  • Newbie
  • *
  • Posts: 4
    • View Profile
[SFML 2.0] RenderTexture memory usage
« on: March 03, 2013, 01:42:45 am »
When I create a RenderTexture and call create(40, 40), it uses about 4 mb of memory. Is this normal?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: [SFML 2.0] RenderTexture memory usage
« Reply #1 on: March 03, 2013, 01:48:17 am »
How do you measure the memory usage and specially the change?
Besides the RenderTexture is allocated on the GPU, so are you checking the GPU memory? :D
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Grain

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: [SFML 2.0] RenderTexture memory usage
« Reply #2 on: March 03, 2013, 01:52:57 am »
How do you measure the memory usage and specially the change?
Besides the RenderTexture is allocated on the GPU, so are you checking the GPU memory? :D

I'm creating a new RenderTexture every second and calling create(), and checking the memory in windows task manager. How would I go about checking the GPU memory?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: [SFML 2.0] RenderTexture memory usage
« Reply #3 on: March 03, 2013, 02:06:32 am »
and checking the memory in windows task manager.
That's not how one accurately messures memory changes and mostly never tells anything about the actual memory usage. The OS can assign as much memory as it wants and release whenever it wants.

How would I go about checking the GPU memory?
Probably with some GPU tools, I don't know.

Do you already have something running or even run into performance issues, or are you just paranoid about memory usage? ;D

As for the plain calucaltion of an image size: width*height*4*8 bits
4 because we have 4 Uint8 values for each channel in RGBA.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Grain

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: [SFML 2.0] RenderTexture memory usage
« Reply #4 on: March 03, 2013, 02:19:39 am »
Do you already have something running or even run into performance issues, or are you just paranoid about memory usage? ;D

After creating a few hundred RenderTextures, the program hangs (when I run out of memory).
« Last Edit: March 03, 2013, 02:39:27 am by Grain »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
AW: [SFML 2.0] RenderTexture memory usage
« Reply #5 on: March 03, 2013, 07:40:16 am »
Don't use hundred of RenderTexture. In theory you could do all operations on one single rebder texture.
RT are heavy and limited resources and one as to be careful with them.

What are you trying to achieve?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: [SFML 2.0] RenderTexture memory usage
« Reply #6 on: March 03, 2013, 08:43:47 am »
RenderTexture internally creates an OpenGL context, which uses a significant amount of RAM.
Laurent Gomila - SFML developer

Grain

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: AW: [SFML 2.0] RenderTexture memory usage
« Reply #7 on: March 03, 2013, 05:55:50 pm »
RT are heavy and limited resources and one as to be careful with them.

This is what I wanted to know. Thanks!

RenderTexture internally creates an OpenGL context, which uses a significant amount of RAM.

Thanks!