Hello, I was trying to play with many windows for my application, and I noticed one strange thing (I see it using default window manager).
When I create a new window the memory goes up.
When I delete the window the memory goes down, but just a little, so that if I continue to create windows the memory used will grow.
I noticed that this only happes if I use antialias in context settings, so maybe it's a driver issue.
Here is a little code to reproduce.
#include <SFML/Graphics.hpp>
#include <vector>
int main()
{
sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
sf::CircleShape shape(100.f);
shape.setFillColor(sf::Color::Green);
std::vector<sf::RenderWindow*> windows;
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
else if (event.type == sf::Event::KeyPressed)
{
if (event.key.code == sf::Keyboard::A)
{
sf::ContextSettings settings;
settings.antialiasingLevel = 8;
sf::RenderWindow* wnd = new sf::RenderWindow();
wnd->create({ 800, 800 }, "2", sf::Style::Default, settings);
windows.push_back(wnd);
}
if (event.key.code == sf::Keyboard::D)
{
for (auto wnd : windows)
wnd->close();
// delete wnd;
windows.clear();
}
}
}
window.clear();
window.draw(shape);
window.display();
for (auto wnd : windows)
{
wnd->clear();
wnd->display();
}
}
return 0;
}