Memory leaks detection

Do you have a question about makefiles, a compiler or IDE you are using and need to know how to set it up for wxWidgets or why it doesn't compile but other IDE's do ? Post your questions here.
Post Reply
pbneves
Experienced Solver
Experienced Solver
Posts: 86
Joined: Fri Feb 15, 2019 11:37 am

Memory leaks detection

Post by pbneves »

Hi,

I'dd like to try the suggestion present in the book Cross-Platform GUI Programming with wxWidgets for detect memory leaks, and for activating wxWidgets memory checker in Linux we have to activate some switches for configure as:

Code: Select all

--enable-debug --enable-mem_tracing --enable-debug_cntxt
I'm using Netbeans 8.2 with Slackware64 Linux. How can I tell Netbeans to activate these switches?
Thanks,
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7458
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Memory leaks detection

Post by ONEEYEMAN »

Hi,
What version of wx do you use?
Did you compile it yourself or use the one from the repository?

Thank you.
pbneves
Experienced Solver
Experienced Solver
Posts: 86
Joined: Fri Feb 15, 2019 11:37 am

Re: Memory leaks detection

Post by pbneves »

Hi,

I'm using 3.0.4 version and I use the repository version.
Thanks,
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7458
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Memory leaks detection

Post by ONEEYEMAN »

Hi,
Which packages did you install?
On top of that - I believe "mem-tracing" is buggy and won't even compile wx.

The best way to identify memory leaks is the standard *nix tools - valgrind is one of such tools.

Usage:

Code: Select all

valgrind --demangle=yes --log-file=memcheck.log --keak-check=full <binary_name>
Or try to run the program under MSVC debugger - it will show leaks if they are present.

Thank you.
pbneves
Experienced Solver
Experienced Solver
Posts: 86
Joined: Fri Feb 15, 2019 11:37 am

Re: Memory leaks detection

Post by pbneves »

Thank you for your reply.
I've tried valgrind but it seems to raise false positives :( That's why I wanted to try the suggestion from the book.
I'll try de MSVC :( option.
Thanks once more.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7458
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Memory leaks detection

Post by ONEEYEMAN »

Hi,
Yes, valgrind unfortunately is not very reliable.

But if you are absolutely sure you used delete for every pointer, then you don't have to worry about anything. ;-)

Thank you.
DavidHart
Site Admin
Site Admin
Posts: 4252
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: Memory leaks detection

Post by DavidHart »

Hi,
pbneves wrote: Tue Mar 26, 2019 5:13 pm I've tried valgrind but it seems to raise false positives :(
Indeed it does!

However you might find this wxWiki page helpful. It also has a link to this suppression file which, though for wx2.9.5, is likely still to work.

Regards,

David
Post Reply