debugging memory leak

Hi,

I am currently trying to debug a memory leak. A while back, I found
this very effective way where I was able to take a *snapshot* of the
current heap, and then later one, take another *snapshot*, and then
perform a *diff* of the two snapshots. It would then output all the
new memory allocations that were never cleaned up (assuming I took the
second snapshot when I expected all memory allocations to be cleaned).
Is someone familiar with this strategy? Can someone point me to the
command that does this?

Thanks,
J

Assuming you are talking about user space, then check out
http://msdn.microsoft.com/en-us/library/974tc9t1(v=VS.80).aspx

Don Burn
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of JonathonS
Sent: Wednesday, May 23, 2012 12:53 PM
To: Kernel Debugging Interest List
Subject: [windbg] debugging memory leak

Hi,

I am currently trying to debug a memory leak. A while back, I found this
very effective way where I was able to take a *snapshot* of the current
heap, and then later one, take another *snapshot*, and then perform a *diff*
of the two snapshots. It would then output all the new memory allocations
that were never cleaned up (assuming I took the second snapshot when I
expected all memory allocations to be cleaned).
Is someone familiar with this strategy? Can someone point me to the
command that does this?

Thanks,
J


WINDBG is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

i am not sure about snapshots but !heap -l in windbg will point out leaked heap

The !heap -l command detects leaked heap blocks. It uses a garbage
collector algorithm to detect all busy blocks from the heaps that are
not referenced anywhere in the process address space. For huge
applications, it can take a few minutes to complete. This command is
only available in Windows XP and later versions of Windows.

On 5/23/12, Don Burn wrote:
> Assuming you are talking about user space, then check out
> http://msdn.microsoft.com/en-us/library/974tc9t1(v=VS.80).aspx
>
>
>
> Don Burn
> Windows Filesystem and Driver Consulting
> Website: http://www.windrvr.com
> Blog: http://msmvps.com/blogs/WinDrvr
>
>
>
> -----Original Message-----
> From: xxxxx@lists.osr.com
> [mailto:xxxxx@lists.osr.com] On Behalf Of JonathonS
> Sent: Wednesday, May 23, 2012 12:53 PM
> To: Kernel Debugging Interest List
> Subject: [windbg] debugging memory leak
>
> Hi,
>
> I am currently trying to debug a memory leak. A while back, I found this
> very effective way where I was able to take a snapshot of the current
> heap, and then later one, take another snapshot, and then perform a
> diff
> of the two snapshots. It would then output all the new memory allocations
> that were never cleaned up (assuming I took the second snapshot when I
> expected all memory allocations to be cleaned).
> Is someone familiar with this strategy? Can someone point me to the
> command that does this?
>
> Thanks,
> J
>
> —
> WINDBG is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
>
> —
> WINDBG is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>

Have you tried the Application Verifier (it’s a free download)?

I am not aware of any snapshot commands, and I generally find such
techniques fairly useless. They just require too much effort.

Are you building your app in debug mode and linking with the debug
libraries? These already provide so e of what you are asking for, and
there are subroutines youu can call to get the list of allocated objects,
and these are documented in the MSDN.

There are many techniques for avoiding storage leaks, but I’ve found the
most effective one is to use C++.

I spent years dealing with storage leaks. Then I learned to use C++
effectively, and I almost never have storage leaks.

But if you have not compiled and run a debug version of your app, and have
not run it under Application Verifier, you need to start with those.
joe

Hi,

I am currently trying to debug a memory leak. A while back, I found
this very effective way where I was able to take a *snapshot* of the
current heap, and then later one, take another *snapshot*, and then
perform a *diff* of the two snapshots. It would then output all the
new memory allocations that were never cleaned up (assuming I took the
second snapshot when I expected all memory allocations to be cleaned).
Is someone familiar with this strategy? Can someone point me to the
command that does this?

Thanks,
J


WINDBG is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

The app the OP is looking for is probably umdh.exe.


From: xxxxx@flounder.com
Sent: 5/28/2012 12:58 AM
To: Kernel Debugging Interest List
Subject: Re: [windbg] debugging memory leak

Have you tried the Application Verifier (it’s a free download)?

I am not aware of any snapshot commands, and I generally find such
techniques fairly useless. They just require too much effort.

Are you building your app in debug mode and linking with the debug
libraries? These already provide so e of what you are asking for, and
there are subroutines youu can call to get the list of allocated objects,
and these are documented in the MSDN.

There are many techniques for avoiding storage leaks, but I’ve found the
most effective one is to use C++.

I spent years dealing with storage leaks. Then I learned to use C++
effectively, and I almost never have storage leaks.

But if you have not compiled and run a debug version of your app, and have
not run it under Application Verifier, you need to start with those.
joe

Hi,

I am currently trying to debug a memory leak. A while back, I found
this very effective way where I was able to take a *snapshot* of the
current heap, and then later one, take another *snapshot*, and then
perform a *diff* of the two snapshots. It would then output all the
new memory allocations that were never cleaned up (assuming I took the
second snapshot when I expected all memory allocations to be cleaned).
Is someone familiar with this strategy? Can someone point me to the
command that does this?

Thanks,
J


WINDBG is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


WINDBG is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer