I think there is a memory leak in the latest release of SFML. I'm using the CRT Debugging feature to check for memory leaks while debugging the application in Visual C++.
Here is my output:
'TreasureHunt.exe': Loaded 'C:\Dev\TreasureHunt\TreasureHunt\Build\Debug\TreasureHunt.exe', Symbols loaded.
'TreasureHunt.exe': Loaded 'C:\Windows\System32\ntdll.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\kernel32.dll'
'TreasureHunt.exe': Loaded 'C:\Dev\TreasureHunt\TreasureHunt\Build\Debug\sfml-window-d.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\opengl32.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\msvcrt.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\advapi32.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\rpcrt4.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\gdi32.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\user32.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\glu32.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\ddraw.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\dciman32.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\setupapi.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\oleaut32.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\ole32.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\dwmapi.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\winmm.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\oleacc.dll'
'TreasureHunt.exe': Loaded 'C:\Dev\TreasureHunt\TreasureHunt\Build\Debug\sfml-system-d.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc90.debugcrt_1fc8b3b9a1e18e3b_9.0.30729.1_none_bb1f6aa1308c35eb\msvcp90d.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\winsxs\x86_microsoft.vc90.debugcrt_1fc8b3b9a1e18e3b_9.0.30729.1_none_bb1f6aa1308c35eb\msvcr90d.dll'
'TreasureHunt.exe': Loaded 'C:\Dev\TreasureHunt\TreasureHunt\Build\Debug\sfml-graphics-d.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\imm32.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\msctf.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\lpk.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\usp10.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\uxtheme.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\atioglxx.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\version.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\ws2_32.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\nsi.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\atiadlxx.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\wintrust.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\crypt32.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\msasn1.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\userenv.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\secur32.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\imagehlp.dll'
Detected memory leaks!
Dumping objects ->
{145} normal block at 0x00116350, 20 bytes long.
Data: <Pc Pc Pc > 50 63 11 00 50 63 11 00 50 63 11 00 CD CD CD CD
{144} normal block at 0x00116238, 216 bytes long.
Data: < u > AC 75 03 10 01 00 00 00 01 00 00 00 00 00 00 00
{143} normal block at 0x001161F8, 4 bytes long.
Data: <8b > 38 62 11 00
Object dump complete.
'TreasureHunt.exe': Loaded 'C:\Windows\System32\dinput.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\hid.dll'
'TreasureHunt.exe': Loaded 'C:\Windows\System32\clbcatq.dll'
The program '[5672] TreasureHunt.exe: Native' has exited with code 0 (0x0).
and here is the code I'm using:
#define _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#include <SFML/Graphics.hpp>
int main()
{
_CrtDumpMemoryLeaks();
sf::RenderWindow App(sf::VideoMode(1024, 728, 32), "Treasure Hunt");
sf::Image Image;
if (!Image.LoadFromFile("data/background.png"))
return EXIT_FAILURE;
sf::Sprite Sprite(Image);
while (App.IsOpened())
{
sf::Event Event;
while (App.GetEvent(Event))
{
if (Event.Type == sf::Event::Closed)
App.Close();
}
float ElapsedTime = App.GetFrameTime();
App.Clear();
App.Draw(Sprite);
App.Display();
}
return EXIT_SUCCESS;
}
Just wanted to let you guys know. I don't know if it's in my application or in the actual SFML library, but hopefully a better developer than me can help me