Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3599886
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T20:25:27+00:00 2026-05-18T20:25:27+00:00

I’m trying to track down a memory leak in a C++ application in Windows

  • 0

I’m trying to track down a memory leak in a C++ application in Windows and I’ve got a memory dump of the application with a large number of leaked objects. I’m using Windbg to track them down by doing the following:

// Get heap stats
!heap -s

This shows the following:

  Heap     Flags   Reserv  Commit  Virt   Free  List   UCR  Virt  Lock  Fast 
                    (k)     (k)    (k)     (k) length      blocks cont. heap 
-----------------------------------------------------------------------------
00150000 00000002    1024    272    272     20     2     1    0      0   L  
00250000 00001002      64     24     24      9     1     1    0      0   L  
00260000 00008000      64     12     12     10     1     1    0      0      
003a0000 00001002      64     24     24      1     0     1    0      0   L  
003d0000 00001002  392256 292256 292256      3     1     1    0     49   L  
00bb0000 00001002      64     56     56      1     1     1    0      0   L  
00c30000 00001002      64     32     32      7     1     1    0      0   L  
-----------------------------------------------------------------------------

So I can see that heap 003d0000 contains the leaking objects so I use:

// Get individual heap stats
!heap -stat -h 003d0000

Which shows:

heap @ 003d0000
  group-by: TOTSIZE max-display: 20
    size     #blocks     total     ( %) (percent of total busy bytes)
    98 105de3 - 9b7bec8  (61.59)
    50 f052f - 4b19eb0  (29.75)
    8 21829f - 10c14f8  (6.64)
    2a0 881 - 1652a0  (0.55)
    d0 a5e - 86c60  (0.21)
    48 19a1 - 73548  (0.18)
    c0 8f0 - 6b400  (0.17)
    490 155 - 613d0  (0.15)
    40 1300 - 4c000  (0.12)
    20 1ff1 - 3fe20  (0.10)
    7c 7e1 - 3d0fc  (0.09)
    28 120c - 2d1e0  (0.07)
    8708 5 - 2a328  (0.07)
    34 8f4 - 1d190  (0.05)
    e0 1dd - 1a160  (0.04)
    bb88 2 - 17710  (0.04)
    f0 12b - 11850  (0.03)
    30 45d - d170  (0.02)
    10 b73 - b730  (0.02)
    90 f4 - 8940  (0.01)

So I have a leak of an object 98 bytes in size, I can track down what that object is with:

!heap -flt s 98

This shows:

<snip>
19f56c38 0014 0014  [01]   19f56c40    00098 - (busy)
      MyApp!MyObject::`vftable'
<snip>

This is where my knowledge of Windbg runs out, I can see that the object on the heap is of class MyObject but how do I find out where this object was created?

Any help would be very much appreciated!

Thanks,
J

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T20:25:28+00:00Added an answer on May 18, 2026 at 8:25 pm

    Here is a nice, short tutorial. You need to enable some Global Flags to get the stack trace, though. Also, depending on your platform / configuration you may run into an unfortunate problem.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am trying to loop through a bunch of documents I have to put
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I'm making a simple page using Google Maps API 3. My first. One marker

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.