Running Windows 10. Compiling with Visual Studio 2022. Building with SFML 2.6, official VS17 builds (
https://www.sfml-dev.org/files/SFML-2.6.0-windows-vc17-32-bit.zip, etc.).
Problem: SFML applications are using a fair amount of memory, both upfront and as they grow in complexity. Yes, I know that this problem has been reported before.
Compiler options (release builds): SFML_STATIC, full optimization (speed). Use the statically-linked, release versions of the libraries (and their dependences).
Linker options (debug builds): dynamic linking, no optimization. Use the provided DLLs with debugging data.
Release build (Win32), using the window display code at
www.sfml-dev.org/tutorials/2.6/window-window.php, "Bringing the Window to Life". No other changes. Uses 72 MB.
Repeat with debug build. Repeat with x64 release and debug. Repeat, using the GCC 13.1.0 MinGW compiled versions of the SFML 2.6 libraries. Uses slightly more (<10 MB) in some cases, as expected, but never less than the VS17 32-bit release build.
Duplicate the line "sf::RenderWindow window(sf::VideoMode(800, 600), "My window");" to make four separate windows. Memory usage goes up to 155 MB.
Code follows:
#include <SFML/Graphics.hpp>
int main()
{
sf::RenderWindow window(sf::VideoMode(800, 600), "My window");
sf::RenderWindow window2(sf::VideoMode(800, 600), "My second window");
sf::RenderWindow window3(sf::VideoMode(800, 600), "My third window");
sf::RenderWindow window4(sf::VideoMode(800, 600), "My fourth window");
// run the program as long as the window is open
while (window.isOpen())
{
// check all the window's events that were triggered since the last iteration of the loop
sf::Event event;
while (window.pollEvent(event))
{
// "close requested" event: we close the window
if (event.type == sf::Event::Closed)
window.close();
}
sf::sleep(sf::milliseconds(100));
}
return 0;
}
Remove the source files. Add the source and header files for the Island app in the examples folder. Re-compile from scratch, using the 32-bit release version of the official MSVC17 libraries. Copy the "resources" folder. Fire up the executable. 209 MB of memory used when generating the terrain. 154 MB used when idle.
Imma gonna level with you. I got feelings about this. I got feeling so hard I need to break out the Newspeak with you all and say that this is DoublePlusUnGood.