So I had to take a little bit of a break from this project. But now I'm back on it, and I am just absolutely stunned by this memory issue. After playing with it some more, I decided to strip down every thing to the bare minimum. In my project, I have the following 'main.cpp':
#include <SFML\Window.hpp>
#include <SFML\Graphics.hpp>
using namespace sf;
int main(int argc, char* argv[]) {
RenderWindow mWindow;
mWindow.Create(VideoMode(800, 600), "SFML TEST");
mWindow.SetFramerateLimit(20);
Event e;
while (mWindow.IsOpened()) {
while (mWindow.PollEvent(e)) {
if (e.Type == Event::Closed)
mWindow.Close();
}
mWindow.Clear();
mWindow.Display();
}
return 0;
}
Now there are other files and functions in this project, but that is my main.cpp, and it's not referencing anything outside SFML. When I run this program, I see a steady increase in memory usage by monitoring "Memory (Private Working Set)" in the Task Manager.
To further troubleshoot this, I created a new, Empty project. I copy-pasted that same exact main.cpp into the new, empty project, and set up the environment for SFML just like I did for the old project. Just to show you guys, this is my new main.cpp, which is identical to the last one:
#include <SFML\Window.hpp>
#include <SFML\Graphics.hpp>
using namespace sf;
int main(int argc, char* argv[]) {
RenderWindow mWindow;
mWindow.Create(VideoMode(800, 600), "SFML TEST");
mWindow.SetFramerateLimit(20);
Event e;
while (mWindow.IsOpened()) {
while (mWindow.PollEvent(e)) {
if (e.Type == Event::Closed)
mWindow.Close();
}
mWindow.Clear();
mWindow.Display();
}
return 0;
}
What's so puzzling is that this new code does not increase the memory usage! It stays at a constant value relatively and I see no sign of any memory leak!!!
How is this possible?!??!! :shock:
The codes are identical, and I've haven't modified any default Visual Studio (2010) settings in both projects.
If anyone could explain why this could be happening, please explain it to me, as I'm out of ideas.