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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - 16bit_port

Pages: [1]
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
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?

2
Window / [SOLVED] Very simple window (crashes)
« on: July 14, 2011, 05:17:37 pm »
I'm using the 1.6 version and VS2010.

Code: [Select]
#include <SFML/Window.hpp>

#pragma comment( lib, "sfml-window" )
#pragma comment( lib, "sfml-window-d" )

int main()
{
    sf::Window App1( sf::VideoMode(800, 600, 32), "Window 1" );
    App1.Close();
    return 0;
}


It crashes at exit of main() (at } ). It says "Run-Time Check Failure #2 - Stack around the variable 'App1' was corrupted."

It happens with both debug and release build.

Pages: [1]