i'm trying track down memory leak in c++ application in windows , i've got memory dump of application large number of leaked objects. i'm using windbg track them down doing following:
// heap stats !heap -s
this shows 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 can see heap 003d0000 contains leaking objects use:
// 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 have leak of object 98 bytes in size, can track down object with:
!heap -flt s 98
this shows:
<snip> 19f56c38 0014 0014 [01] 19f56c40 00098 - (busy) myapp!myobject::`vftable' <snip>
this knowledge of windbg runs out, can see object on heap of class myobject
how find out object created?
any appreciated!
thanks, j
here nice, short tutorial. need enable global flags stack trace, though. also, depending on platform / configuration may run unfortunate problem.
Comments
Post a Comment