Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Memory Leak?  (Read 4375 times)

0 Members and 1 Guest are viewing this topic.

YellowShadow

  • Newbie
  • *
  • Posts: 29
    • AOL Instant Messenger - ehwatsupdoc21
    • View Profile
Memory Leak?
« on: January 11, 2010, 10:39:55 pm »
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:

Quote

'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:
Code: [Select]

#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 :)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Memory Leak?
« Reply #1 on: January 11, 2010, 11:45:26 pm »
Some leaks have already been fixed after the latest release.
Laurent Gomila - SFML developer

YellowShadow

  • Newbie
  • *
  • Posts: 29
    • AOL Instant Messenger - ehwatsupdoc21
    • View Profile
Memory Leak?
« Reply #2 on: January 11, 2010, 11:51:10 pm »
Quote from: "Laurent"
Some leaks have already been fixed after the latest release.


Should I check out SFML from SVN and compile that and use that with my project?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Memory Leak?
« Reply #3 on: January 12, 2010, 12:01:25 am »
It those leaks really bother you... then yes. But it's not that important, it's a single leak that happens at exit. It's not like if the memory was increasing at each loop.
Laurent Gomila - SFML developer

YellowShadow

  • Newbie
  • *
  • Posts: 29
    • AOL Instant Messenger - ehwatsupdoc21
    • View Profile
Memory Leak?
« Reply #4 on: January 12, 2010, 12:07:45 am »
Okay, I'll try the SVN version of SFML. Thanks :)