Domanda

I've written a simple program, which renders the screen green and renders a .png image to the screen (which has hello world written on it). I am using a Window and a Texture class, and I have a main.cpp file. I deleting the pointers in the destructor, and I am using SDL's DestroyTexture/Window/etc functions as well. When I start my program, it eats up ~11MBs of RAM. I think it is too much, but I could be wrong. What do you say?

È stato utile?

Soluzione

That's normal. Its is the "blind of poker", the bet you need to pay no matter what is in your hand, no matter your software.

You may think you are simple calling functions but there's a whole background behind it.

Calls to other functions, calls to SO functions who calls more and more. All of this using shared libraries, who you didn't call but you need.

Altri suggerimenti

If you have the feeling it's working too much to be this small, that maybe true if you're not limiting your framerate.

If your window can refresh itself 5000 times in a second (exactly because the program is so small) it will eat too much memory.

Read this for a good explanation on how to calculate and limit framerate in your sdl program.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top