16
Window / Re: OSX Crash in pollEvent()
« on: April 04, 2019, 06:18:20 pm »
It does look similar, there appears to be some memory "leak" in SFML on Mac. I ran a barebones example and observed the memory using Xcode's Instruments. It didn't show any leaks, however heap allocations increased by about 1 MB/s. I let it run for a while and when I came back it was up to 3 GB's allocated!
This was the code I was running for this test:
I think this has something to do with my crash problem, but I'm struggling to see what changes I can make to fix it. The thread expl0it3r linked leads to this fix for bgfx: https://github.com/attilaz/bgfx/commit/e5887de9472fe5e50a947ff9c3297a41972dc83b
But their application is a lot different from mine. should I wrap
This was the code I was running for this test:
int main() {
sf::RenderWindow window(sf::VideoMode(640,480), "Test App");
while (window.isOpen()) {
sf::Event event;
// handle events
while (window.pollEvent(event)) {
switch (event.type) {
case sf::Event::Closed:
window.close();
break;
}
}
window.clear(sf::Color(240,240,240,255));
sf::CircleShape circ(150, 100);
circ.setPosition(100,100);
circ.setFillColor(sf::Color(80,0,0,255));
window.draw(circ);
window.display();
}
return 0;
}
sf::RenderWindow window(sf::VideoMode(640,480), "Test App");
while (window.isOpen()) {
sf::Event event;
// handle events
while (window.pollEvent(event)) {
switch (event.type) {
case sf::Event::Closed:
window.close();
break;
}
}
window.clear(sf::Color(240,240,240,255));
sf::CircleShape circ(150, 100);
circ.setPosition(100,100);
circ.setFillColor(sf::Color(80,0,0,255));
window.draw(circ);
window.display();
}
return 0;
}
I think this has something to do with my crash problem, but I'm struggling to see what changes I can make to fix it. The thread expl0it3r linked leads to this fix for bgfx: https://github.com/attilaz/bgfx/commit/e5887de9472fe5e50a947ff9c3297a41972dc83b
But their application is a lot different from mine. should I wrap
while (window.pollEvent(event)) { ... }
with @autoreleasepool { ... }
?