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

Author Topic: Valgrind with SFML  (Read 4070 times)

0 Members and 1 Guest are viewing this topic.

Chivos

  • Newbie
  • *
  • Posts: 19
    • View Profile
Valgrind with SFML
« on: April 16, 2013, 01:54:45 am »
I have been working on getting Valgrind to work all day. Valgrind works well when I do not include any SFML headers, but the second I include <SFML/Graphics.hpp>, I get something like 2.6million errors. Obviously there is no way that this is being caused by SFML lol, but I am not sure what to do about it. Does anyone know why this might be happening? Any advice or help would be greatly appreciated! ;)

The Terminator

  • Full Member
  • ***
  • Posts: 224
  • Windows and Mac C++ Developer
    • View Profile
Re: Valgrind with SFML
« Reply #1 on: April 16, 2013, 02:34:33 am »
What version of SFML are you using?
Did you compile with Cmake?
Did you link the correct libraries?
What are your errors?

So many questions, not very many answers  ;)
Current Projects:
Technoport

Chivos

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: Valgrind with SFML
« Reply #2 on: April 16, 2013, 02:36:56 am »
lol, i'm still using 1.6.. I know.. I know heheh ;)

I DL'd with the repository

I am pretty sure I am linked the correct libraries. I do not think it would compile if not. When I compile it to run valgrind on it, I use this.

g++  main.cpp /usr/lib/libsfml-window.so.1.6 /usr/lib/libsfml-graphics.so.1.6 -o test

to run:

valgrind --leak-check=full  ./test

main.cpp includes <SFML/Graphics.hpp> and has an int main(){return 0;}

As far as the errors, there are 2.6million so I assume they don't mean much as it is something else I am doing wrong heh.
« Last Edit: April 16, 2013, 02:42:41 am by Chivos »

The Terminator

  • Full Member
  • ***
  • Posts: 224
  • Windows and Mac C++ Developer
    • View Profile
Re: Valgrind with SFML
« Reply #3 on: April 16, 2013, 03:47:05 am »
You say that you're only using graphics and window, but both depend on system. Try including libsfml-system when you run your code.
Current Projects:
Technoport

Chivos

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: Valgrind with SFML
« Reply #4 on: April 16, 2013, 07:34:14 am »
I am having the exact same problem. I have also switched to 2.0 to see if that would help. The number of errors is still ridiculously high. I have to crash out, but I think tomorrow I will just try to reinstall Valgrind or something. If anyone has any ideas, please feel free to chime in, I am at a lose! :(


Just checked again, Valgrind still works as long as nothing SFML touches it heh. ALL day because I wanted to see if I had any memory leaks lol ;)
« Last Edit: April 16, 2013, 07:36:48 am by Chivos »

binary1248

  • SFML Team
  • Hero Member
  • *****
  • Posts: 1405
  • I am awesome.
    • View Profile
    • The server that really shouldn't be running
Re: Valgrind with SFML
« Reply #5 on: April 16, 2013, 04:22:19 pm »
SFML makes use of numerous static variables that are instanciated at application startup whether you use SFML or not. Many of these also have to do with OpenGL context management which might look like a leak if you have "unhealthy" graphics drivers. Unless you have a reference to a specific line of code in the SFML codebase (yes, Valgrind shows you the line when possible) that really shows that memory is allocated that might not be freed, everything else is part of the operating system and we don't go there.
SFGUI # SFNUL # GLS # Wyrm <- Why do I waste my time on such a useless project? Because I am awesome (first meaning).

Chivos

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: Valgrind with SFML
« Reply #6 on: April 16, 2013, 05:08:05 pm »
Thank you very much binary1248!!! Updated graphics drivers and it solved my problem!! ;)

 

anything