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

Author Topic: Memory leak with music  (Read 3452 times)

0 Members and 1 Guest are viewing this topic.

Dante12129

  • Newbie
  • *
  • Posts: 24
    • View Profile
Memory leak with music
« on: May 19, 2013, 02:00:30 am »
I am trying to load a music file. Loading and playing and using it work fine, but when I have an sf::Music object in my program, it gives me a return status of -2147418113.

Here's my code:
#include <SFML/Graphics.hpp>
#include <SFML/Audio.hpp>

int main()
{
        sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");

        sf::Music background_music;
        background_music.openFromFile("Five Armies.ogg");

        while (window.isOpen())
        {
            //Handle events
                sf::Event event;
                while (window.pollEvent(event))
                {
                        if (event.type == sf::Event::Closed)
                                window.close();
                }
                //Logic

                //Render
        }

        return 0;
}

 

I am using MinGW 4.7.1 on Windows 7 with Code::Blocks as my IDE.

I have narrowed it down to the music because if I comment out the music and loading it will work without leaking. And it gives me the same return value whether I play it or not.

eigenbom

  • Full Member
  • ***
  • Posts: 228
    • View Profile
Re: Memory leak with music
« Reply #1 on: May 19, 2013, 02:34:31 am »
Might be related to this: https://github.com/SFML/SFML/issues/30

Dante12129

  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: Memory leak with music
« Reply #2 on: May 19, 2013, 03:28:18 am »
But that says that it's not a problem for Windows 7. Also, here's my call stack from gdb:


eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Memory leak with music
« Reply #3 on: May 20, 2013, 04:07:29 pm »
Are you mixing debug and release modes?

I am trying to load a music file. Loading and playing and using it work fine, but when I have an sf::Music object in my program, it gives me a return status of -2147418113.
When exactly do you get the crash? Is it while loading or really just when you close the application?
If it's when closing then it really might be issue #30 or outdated audio drivers...

Besides this is not really called a memory leak, this is a crash. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Dante12129

  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: Memory leak with music
« Reply #4 on: May 21, 2013, 12:07:05 am »
Well it runs fine and never crashes, so I guess it is an audio driver (the hardware in my computer is a few years old, like I have integrated graphics that only support OpenGL 2.0).

 

anything