Tool to find memory leaks

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 2626
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Tool to find memory leaks

Postby ONEEYEMAN » Tue Sep 11, 2018 2:35 pm

Hi,
Sorry for the question not specifically related to wx, but I am stuck and don't see the way forward.

I have an application that I recently started compiling with MSVC 2017. Before that I used 2010 version.
The application consist of 1 binary executable and couple of DLLs. It also uses a MT. The application is using wxWidgets 3.1.1 and I'm testing on Windows 8.1.

Somewhere during the process of writing it I introduced a memory leaks.
I tried to inspect the code visually for any new/delete mismatch, but it is very hard as an application is big (not huge yet ;-)).
I tried to switch back to MSVC 2010 and use vld on it, but when I did that the application failed to start and crashed (not asserted).

So, now I'm curious - what is the best solution to find a memory leaks on Windows?
I would've tried to run Linux' valgrind, but my Linux machine is no in service with the hardware issues. And I'm having difficulties with the OSX/Xcode run ATM.

Do you have any suggestions? I prefer MSVC 2017 solution, since 2010 does not implement necessary C++11 feature(s) I'm using. Is there any free or maybe an evaluation tool I can use to check for leakage?

Thank you.

Manolo
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 579
Joined: Mon Apr 30, 2012 11:07 pm

Re: Tool to find memory leaks

Postby Manolo » Tue Sep 11, 2018 4:09 pm


ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 2626
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Tool to find memory leaks

Postby ONEEYEMAN » Tue Sep 11, 2018 4:56 pm

Hi, Manolo,
Thank you for the links.
Most of the packages from the first links are profilers to improve the performance. I'm not there yet, even though it would be nice to do in the near future.
The things that are used for memory leaks are proprietary and cost money, but I found at least one tool that have a trial version and will check that (deleaker).

Thank you.

User avatar
T-Rex
Moderator
Moderator
Posts: 1164
Joined: Sat Oct 23, 2004 9:58 am
Location: Zaporizhzhya, Ukraine
Contact:

Re: Tool to find memory leaks

Postby T-Rex » Mon Sep 17, 2018 11:14 am

Visual Leak Detector worked fine for me in VS

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 2626
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Tool to find memory leaks

Postby ONEEYEMAN » Mon Sep 17, 2018 2:48 pm

T-Rex,
For VLD crashed the program and it didn't even started.

Thank you.

catalin
Moderator
Moderator
Posts: 1456
Joined: Wed Nov 12, 2008 7:23 am
Location: Romania

Re: Tool to find memory leaks

Postby catalin » Mon Sep 17, 2018 8:59 pm

ONEEYEMAN wrote:VLD crashed the program and it didn't even started.

What VLD version did you use? I suspect it was not the latest, aka 2.5.1, because it des work with VS 2017 too.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 2626
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Tool to find memory leaks

Postby ONEEYEMAN » Mon Sep 17, 2018 9:20 pm

catalin,
No it was not the latest version.
I will try to get the latest one either today or tomorrow and re-try with my program.

Thank you.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 2626
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Tool to find memory leaks

Postby ONEEYEMAN » Sat Sep 22, 2018 2:08 am

catalin,
I'm attaching the screenshot of running my application under MSVC 2017 compiled and linked with the latest VLD.

Do you know how do I fix it? Is there something missing on my Win 8.1 system?

Thank you.
VLD_screenshot.png

catalin
Moderator
Moderator
Posts: 1456
Joined: Wed Nov 12, 2008 7:23 am
Location: Romania

Re: Tool to find memory leaks

Postby catalin » Sat Sep 22, 2018 5:56 am

How did you use vld in your code?
Is it picking up the [correct] vld dll? BTW, which version is "latest"?

p.s. did you try it in one of the samples?

User avatar
T-Rex
Moderator
Moderator
Posts: 1164
Joined: Sat Oct 23, 2004 9:58 am
Location: Zaporizhzhya, Ukraine
Contact:

Re: Tool to find memory leaks

Postby T-Rex » Sat Sep 22, 2018 10:46 am


ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 2626
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Tool to find memory leaks

Postby ONEEYEMAN » Sat Sep 22, 2018 3:11 pm

Hi,
catalin wrote:How did you use vld in your code?

In the binary and every dll in the solution for one file I include vld.h.
In the project properties for executable and all DLL projects I add "vld.lib" in the "Linker->Input" and then added the directory for it in "Linker->General".

catalin wrote:Is it picking up the [correct] vld dll? BTW, which version is "latest"?

I don't see why not. I copied the DLL over to the directory where the binary is.
And I believe the latest version 2.5.1.

catalin wrote:p.s. did you try it in one of the samples?


No, not yet.

Thank you.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 2626
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Tool to find memory leaks

Postby ONEEYEMAN » Sun Sep 23, 2018 4:06 am

Hi,
T-Rex wrote:You should be able to download the Debug Symbols for Windows DLLs from within Visual Studio
https://docs.microsoft.com/en-us/window ... ad-symbols
https://docs.microsoft.com/en-us/window ... bol-server
https://www.screencast.com/t/vsnjdJTLgBq


I grabbed the symbols but nothing helpful came out. See scfreenshots.

Thank you.
Attachments
VLD disassembly.png
VLD with pdb.png


Return to “General Development”

Who is online

Users browsing this forum: No registered users and 3 guests