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

Author Topic: SFML 1.6 suspection for memory leak  (Read 2356 times)

0 Members and 1 Guest are viewing this topic.

skwee

  • Newbie
  • *
  • Posts: 1
    • View Profile
SFML 1.6 suspection for memory leak
« on: August 16, 2010, 10:07:04 pm »
Hi, I'm new here, and I must say SFML is awesome! Very cool and simple, good job sfml developer! :)

However I suspect that there might be a memory leak in one of the modules.
I used QtCreator with Mingw on Window7, here is some relevant data that might help:
Quote

C:\MinGW\bin>"mingw32-g++.exe" -v
Reading specs from ../lib/gcc/mingw32/3.4.5/specs
Configured with: ../gcc-3.4.5-20060117-3/configure --with-gcc --with-gnu-ld --wi
th-gnu-as --host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads --dis
able-nls --enable-languages=c,c++,f77,ada,objc,java --disable-win32-registry --d
isable-shared --enable-sjlj-exceptions --enable-libgcj --disable-java-awt --with
out-x --enable-java-gc=boehm --disable-libgcj-debug --enable-interpreter --enabl
e-hash-synchronization --enable-libstdcxx-debug
Thread model: win32
gcc version 3.4.5 (mingw-vista special r3)


Here is the code I compiled in debug and linked to:
libsfml-system-d.a libsfml-window-d.a libsfml-graphics-d.a
Code: [Select]

#include <SFML/Graphics.hpp>

int main()
{
    // Create the main window
    sf::Window App(sf::VideoMode(800, 600, 32), "SFML Events");

    App.SetFramerateLimit(60);

    // Start main loop
    while (App.IsOpened())
    {
        // Process events
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
                App.Close();

            // Escape key : exit
            if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
                App.Close();
        }

        // Display window on screen
        App.Display();
    }

    return EXIT_SUCCESS;
}


The memory started with 9500K, jumped to 10500K then to 12000K then 13000k and then I stopped to monitor :)
Anyway I would like to hear some official reply on this one. If you need any other information (drivers information or what so ever) feel free to ask, Ill be happy to help :)

Have a good day,
skwee.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
SFML 1.6 suspection for memory leak
« Reply #1 on: August 29, 2010, 03:04:56 pm »
You have to know that the windows task manager is not a reliable source to detect memory leaks. The application might pre-allocate much memory even if it's not immediately being used. We have already had some alleged memory leaks, in fact they turned out te be wrongly measured - see here.

If you still think there might be a memory leak, you should use a real tool for it, but as seen, even this can fail. The most certain way is to prove by code that some allocated memory is never freed.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

 

anything