1
Window / memory leaks in sf::window?
« on: July 14, 2011, 11:23:45 pm »
I re-compiled sfml-system and sfml-window through VS2010
simple test program
and here is my output :
LeakCheck.h
NewDebug.h
NewDebug.cpp
What's going on? I'm looking at the source for sf::Window() and it's an empty constructor, so what could be causing this so-called memory leak?
simple test program
Code: [Select]
//////// Used to check memory leaks
#include <stdlib.h>
#include "LeakCheck.h"
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#include <SFML/Window.hpp>
#pragma comment( lib, "sfml-system-d" )
#pragma comment( lib, "sfml-window-d" )
int main()
{
#ifdef _DEBUG
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
_CrtDumpMemoryLeaks();
#endif
sf::Window App;
return 0;
}
and here is my output :
Code: [Select]
Detected memory leaks!
Dumping objects ->
{130} normal block at 0x006C4858, 8 bytes long.
Data: < > BC A2 03 10 00 00 00 00
{129} normal block at 0x006C4808, 20 bytes long.
Data: < Hl Hl Hl > 08 48 6C 00 08 48 6C 00 08 48 6C 00 CD CD CD CD
{128} normal block at 0x006C47C0, 8 bytes long.
Data: < Fl > 0C 46 6C 00 00 00 00 00
{127} normal block at 0x006C4600, 384 bytes long.
Data: < = Gl > 88 3D 03 10 01 00 00 00 01 00 00 00 C0 47 6C 00
{126} normal block at 0x006C45C0, 4 bytes long.
Data: < Fl > 00 46 6C 00
Object dump complete.
The thread 'Win32 Thread' (0x930) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x120) has exited with code 0 (0x0).
Detected memory leaks!
Dumping objects ->
{129} normal block at 0x006C4808, 20 bytes long.
Data: < Hl Hl Hl > 08 48 6C 00 08 48 6C 00 08 48 6C 00 CD CD CD CD
{128} normal block at 0x006C47C0, 8 bytes long.
Data: < Fl > 0C 46 6C 00 00 00 00 00
{127} normal block at 0x006C4600, 384 bytes long.
Data: < = Gl > 88 3D 03 10 01 00 00 00 01 00 00 00 C0 47 6C 00
{126} normal block at 0x006C45C0, 4 bytes long.
Data: < Fl > 00 46 6C 00
Object dump complete.
The program '[3888] test SFML.exe: Native' has exited with code 0 (0x0).
LeakCheck.h
Code: [Select]
#ifdef _MSC_VER
#include "NewDebug.h"
#ifdef _DEBUG
//WARNING: no matching operator delete found; memory will not be freed if initialization throws an exception
#pragma warning( disable: 4291 )
#define new NEW_DEBUG
#endif
#endif
NewDebug.h
Code: [Select]
#ifndef _NEW_DEBUG_H
#define _NEW_DEBUG_H
#include <crtdbg.h>
#ifdef _DEBUG
void* operator new( size_t BlockSize, const char *File, int Line );
#define NEW_DEBUG new( THIS_FILE, __LINE__ )
#define malloc(Size) _malloc_dbg( Size, _NORMAL_BLOCK, THIS_FILE, __LINE__ );
#endif
#endif
NewDebug.cpp
Code: [Select]
#ifdef _MSC_VER
#pragma warning (disable: 4514 ) // Suppress 'unreferenced inline function has been removed'
#ifdef _DEBUG
#include <crtdbg.h>
void* operator new( size_t Size, const char * FileName, int Line )
{
return ::operator new( Size, _NORMAL_BLOCK, FileName, Line );
}
#endif
#endif
What's going on? I'm looking at the source for sf::Window() and it's an empty constructor, so what could be causing this so-called memory leak?