liballeg/allegro_wiki

Valgrind detects memory leaks for your branded "Hello world!" app.

Closed this issue · 4 comments

I've just compiled and tested your "Hello world!" app from here with Valgrind for memory leaks. Here's the leak summary:

==4107== LEAK SUMMARY:
==4107== definitely lost: 577 bytes in 4 blocks
==4107== indirectly lost: 4,752 bytes in 51 blocks
==4107== possibly lost: 0 bytes in 0 blocks
==4107== still reachable: 142,023 bytes in 744 blocks
==4107== suppressed: 0 bytes in 0 blocks

Your official insights are highly appreciated. Valgrind report is attached. Thank you!
valgrindAllegroHelloWorld.txt

Hi @Hack06 - I'm wondering if you're able to share the configuration you used for Valgrind?

From the 'hello world' code, it should hopefully be trivial that cleanup of all of our heap allocations has been performed. We allocate a timer, a queue, a display and a font - and call the various destroy functions at the end of the program. Even then, these calls actually aren't required, as Allegro aggregates and calls them itself atexit. Regardless, we include them for posterity.

At a glance of your report, it looks as though Valgrind may not be configured correctly. The 'leaks', in their majority, are referring to Intel drivers and X11 calls, so I'd hazard a guess they're referring to shared memory.

If you're worried that Allegro itself is leaking memory, it'd be a good idea to open an issue in the allegro repo.

Hi @snoopdouglas - I didn't do any special configuration for Valgrind, just run the command that you see in the log file attached. Regarding to X11, I think it may be caused by the drivers installed on my machine, but I'm not quite sure. I just wanted to bring your attention to it and have your opinion regarding to this and similar issues that you may have already be aware of. Thank you for your reply.

Ah, yeah - in my experience, Valgrind's default settings will give you results like those. I remember getting a similar report with exactly the same (i915) drivers!

Easy for me to say, but you probably don't need to worry about it ;)

Closing this - not sure there's anything left to do.