-
Apr 20th, 2018, 05:12 PM
#1
Thread Starter
Fanatic Member
Identify Memory Leak -- or -- Not
I always wondered how one goes about identifying whether a memory leak is occurring within their App (Process).
Following part of procedure used to get some process memory information. The question is "so what"? That is I (it) return a "snapshot" of memory as a value, but how do I interpret this to determine if there is a leak or not?
Code:
If (GetProcessMemoryInfo(ProcessHandle, tPMC, Len(tPMC)) <> 0) Then
PageFaultCount = Format(tPMC.PageFaultCount, "#,###")
WorkingSetSize = FormatNumber(CStr(tPMC.WorkingSetSize))
PageFileUsage = FormatNumber(CStr(tPMC.PageFileUsage))
End If
-
Apr 20th, 2018, 05:25 PM
#2
Re: Identify Memory Leak -- or -- Not
Can't answer your question directly, but GDI memory leaks can be tracked with Task Manager. See the 'Memory Leak FAQ' link in my signature below.
I'd say GDI leaks are the most common type of leaks. But it is possible to have other types of leaks and maybe others will chime in on how to look for those?
-
Apr 21st, 2018, 08:18 AM
#3
Thread Starter
Fanatic Member
Re: Identify Memory Leak -- or -- Not
LaVolpe:
Excellent WriteUp. Thanks for making it available to all.
-
Apr 21st, 2018, 09:58 AM
#4
Hyperactive Member
Re: Identify Memory Leak -- or -- Not
I've been using a tool called C++ Memory Validator which has pointed out lots of memory issues, which I had no idea I had!
-
Apr 22nd, 2018, 05:18 PM
#5
Re: Identify Memory Leak -- or -- Not
Wikipedia's Memory debugger article has a list of several other tools that you could try. In particular, DynamoRIO's Dr. Memory and Valgrind's Memcheck are both worth checking out.
-
Apr 23rd, 2018, 05:32 AM
#6
Re: Identify Memory Leak -- or -- Not
How do you use Valgrind w/ VB6 projects?
cheers,
</wqw>
-
Apr 23rd, 2018, 08:21 AM
#7
Thread Starter
Fanatic Member
Re: Identify Memory Leak -- or -- Not
Thanks to all poster to date for their input.
-
Apr 23rd, 2018, 08:44 AM
#8
Re: Identify Memory Leak -- or -- Not
Originally Posted by wqweto
How do you use Valgrind w/ VB6 projects?
Well, I haven't actually tried Valgrind out, but according to their About page:
Originally Posted by Valgrind
- Valgrind works with programs written in any language. Because Valgrind works directly with program binaries, it works with programs written in any programming language, be they compiled, just-in-time compiled, or interpreted. The Valgrind tools are largely aimed at programs written in C and C++, because programs written in these languages tend to have the most bugs! But it can, for example, be used to debug and profile systems written in a mixture of languages. Valgrind has been used on programs written partly or entirely in C, C++, Java, Perl, Python, assembly code, Fortran, Ada, and many others.
However, it appears I must have overlooked the fact that they did not actually directly support the Windows platform. Nevertheless, here's what they've got to say on this matter:
Originally Posted by Valgrind
Porting Plans
Windows is not under consideration because porting to it would require so many changes it would almost be a separate project. (However, Valgrind + Wine can be made to work with some effort.) Also, non-open-source OSes are difficult to deal with; being able to see the OS and associated (libc) source code makes things much easier. However, Valgrind is quite usable in conjunction with Wine, which means that it is possible to run Windows programs under Valgrind with some effort.
So, there's a possibility VB6 EXEs could be made to work with Valgrind, but it looks like it'll require significant effort. In that case, that leaves Dr. Memory as the only one of the two still worth trying out.
I did wanted to evaluate Dr. Memory, but I could never get either of the two v1.11.0 Windows packages (MSI installer and portable ZIP file) they have on GitHub to finish downloading. I attempted downloading them on 2 PCs already and also tried to use a download manager (I was denied because GitHub required a username & password) but they still failed. Guess I'll just have to make do with Windows Task Manager and/or Process Hacker.
-
Apr 23rd, 2018, 09:07 AM
#9
Re: Identify Memory Leak -- or -- Not
Looks like you can use Valgrind on Windows with the Windows Subsystem for Linux (Beta) on Windows 10 version 1607 (Build 14393.187) or above. Note, I haven't tried this, but apparently it works with Windows executables through the subsystem.
http://www.albertgao.xyz/2016/09/28/...nd-on-windows/
Also note: Skip section 3. Try it first time. - that section demonstrates a failed attempt and some commenters reported that performing the steps in section 3 forced them to jump through hoops to get things working with the steps listed in section 4. How to deal with it?.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|