While playing with multidimensional arrays of sprites, I began having unexpected crashing. After poking at it for a bit, I discovered that having an array of sprites over 7000 or so crashes my program immediately. Oddly, this behavior is completely reproducible on another machine, but the number of sprites required to crash is a few hundred higher.
The sprites are empty, with no data assigned.
With high working values, I see that this code is only taking about 25MB of ram, so I can't figure why I'm having issues.
SFML Version is the "GCC 4.7 MinGW (DW2) - 32 bits" version of SFML 2.1, latest stable.
I just noticed that my compiler version is GCC 4.8.1 rather than 4.7. Could this be the issue?
EDIT: Just rolled back to 4.7.2, and it's not the issue.
Also forgot to give my OS. Oops...
OS: Windows 7 S1 Professional 64-bit
I'll see if I can try to recreate on linux here in a bit.
The code to produce is the following:
int main(){
sf::RenderWindow window(sf::VideoMode(200, 200), "Test");
sf::Texture textures[10];
sf::Sprite sprites[7200]; //setting this to 7100 still runs
sprites[0].setTexture(textures[0]);
while (window.isOpen()){
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
window.draw(sprites[0]);
window.display();
}
return 0;
}