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

Author Topic: Memory Debugger on SFML  (Read 5026 times)

0 Members and 1 Guest are viewing this topic.

Chi

  • Newbie
  • *
  • Posts: 25
    • View Profile
Memory Debugger on SFML
« on: March 09, 2013, 05:54:51 pm »
Hello all,

during the time i learn C++, iam always using a memory debugger (valgrind on Linux, Dr. Memory on Win) when iam using dynamic allocations in C++. Today i tryd out using Dr. Memory with the SFML Tutorial Example and getting a lots of leaks:

ERRORS FOUND:
      2 unique,     2 total unaddressable access(es)
    863 unique,   916 total uninitialized access(es)
    867 unique,  1523 total invalid heap argument(s)
      0 unique,     0 total GDI usage error(s)
      0 unique,     0 total warning(s)
    885 unique,  1543 total, 353150 byte(s) of leak(s)
    272 unique,   729 total, 3190617 byte(s) of possible leak(s)
ERRORS IGNORED:
   6010 still-reachable allocation(s)

it seems it makes not much sense using a memory debugger during programming with SFML - or? Because its not possible to figure here some memory leaks out.

What you think ?


eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Memory Debugger on SFML
« Reply #1 on: March 09, 2013, 09:04:06 pm »
What version of SFML are you testing? (i.e. where did you get it from).

I've no idea how Dr. Memory works, but checking for Memory Leaks can sometimes be difficult. You can always get false-positives, if the memory is freed after the memory leak detection finishes.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Chi

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Memory Debugger on SFML
« Reply #2 on: March 10, 2013, 11:14:38 am »
Mhh yes i think thats maybe the problem. What a pity.

I was testing the nightly build from your signature VS 10 C++ / 2010 32-Bit


Roose Bolton of the Dreadfort

  • Full Member
  • ***
  • Posts: 113
  • Full-time Procrastinator, Part-time programmer.
    • View Profile
    • Personal Portfolio/Website/Blog
Re: Memory Debugger on SFML
« Reply #3 on: March 10, 2013, 08:52:17 pm »
Use this

http://vld.codeplex.com/

honestly the best 1 I have ever used, not had 1 single false positive yet!

Just link it to your project and

//Include MemoryLeak Detector.
#if _DEBUG
        #include <vld.h>
#endif
 
Trying so very hard to finish at-least one project.

Watch out for the RAII police, they will get you.

www.bantersaurus-games.com

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: Memory Debugger on SFML
« Reply #4 on: March 10, 2013, 09:01:45 pm »
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Chi

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Memory Debugger on SFML
« Reply #5 on: March 10, 2013, 10:25:37 pm »
Use this

http://vld.codeplex.com/

honestly the best 1 I have ever used, not had 1 single false positive yet!

Just link it to your project and

//Include MemoryLeak Detector.
#if _DEBUG
        #include <vld.h>
#endif
 

Thanks, but it seems not to work.
He didnt recognizing here any leak by creating sth via. new without delete.

int *mField;
mField = new int(55);
// delete mField;
 

Roose Bolton of the Dreadfort

  • Full Member
  • ***
  • Posts: 113
  • Full-time Procrastinator, Part-time programmer.
    • View Profile
    • Personal Portfolio/Website/Blog
Re: Memory Debugger on SFML
« Reply #6 on: March 13, 2013, 11:35:54 am »
You are sure its running correctly?

Does it say in your console window thats its activated correctly?
Trying so very hard to finish at-least one project.

Watch out for the RAII police, they will get you.

www.bantersaurus-games.com

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
AW: Memory Debugger on SFML
« Reply #7 on: March 13, 2013, 11:41:08 am »
I've linked it and run some SFML application with it, but I get quite a huge output and always some mem leaks. Not sure if one should trust this.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Memory Debugger on SFML
« Reply #8 on: March 13, 2013, 12:37:26 pm »
during the time i learn C++, iam always using a memory debugger (valgrind on Linux, Dr. Memory on Win) when iam using dynamic allocations in C++.
Instead of fighting symptoms, you should rather fix the cause.

Avoid dynamic allocations that are manually managed. If you encapsulate your memory management consequently, there is hardly a need for memory tools. Take a look at the RAII idiom, and use automatic variables, smart pointers or STL containers instead of raw new and delete.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

Roose Bolton of the Dreadfort

  • Full Member
  • ***
  • Posts: 113
  • Full-time Procrastinator, Part-time programmer.
    • View Profile
    • Personal Portfolio/Website/Blog
Re: AW: Memory Debugger on SFML
« Reply #9 on: March 15, 2013, 01:58:36 pm »
I've linked it and run some SFML application with it, but I get quite a huge output and always some mem leaks. Not sure if one should trust this.

Maybe you have memory leaks then? ;)

I have never had problems with it and I know lots of people who use it and an indie company.. and it has 34,500 downloads with only 6 star reviews.. would be surprised if all along it didn't work.. maybe all the people are dumb dumbs. :P

http://stackoverflow.com/questions/25730/what-is-the-best-free-memory-leak-detector-for-a-c-c-program-and-its-plug-in-d

stackoverflow seem to love it too!
« Last Edit: March 15, 2013, 02:09:07 pm by Tally »
Trying so very hard to finish at-least one project.

Watch out for the RAII police, they will get you.

www.bantersaurus-games.com

 

anything