c++ - Is there a way to get userstack for all heap userptr -
i reading through article detecting memory leak using windbg. trying find way print userstack userptrs appear when heap filtered block of memory particular size. possible ? looking achieve like:
foreach(userptr) dump_to_a_file !heap -p -a userptr
where userptr is: userptr under
heap_entry size prev flags userptr usersize - state 003360e0 03f0 0000 [07] 003360e8 01f64 - (busy) 00338060 03f0 03f0 [07] 00338068 01f64 - (busy) 00339fe0 03f0 03f0 [07] 00339fe8 01f64 - (busy)
i trying in order avoid manual checking thousands of such userptr. give.
this output of !heap -flt s xxx
command contains lot of text before , after heap entry table. let's rid of additional text doing hack
.shell -ci "!heap -flt s xxx" find "["
now it's quite stable output, can used in foreach loop:
.foreach (userptr {.shell -ci "!heap -flt s xxx" find "["}) { .echo ${userptr}}
see how splits each line. let's rid of first 4 tokens (entry, size, prev, flags) , last 3 tokens (usersize, -, state) using /ps 4 /ps 7
.
.foreach /ps 4 /ps 7 (userptr {.shell -ci "!heap -flt s xxx" find "["}) { .echo ${userptr}}
now have pure addresses, useful it, !heap -p -a
.foreach /ps 4 /ps 7 (userptr {.shell -ci "!heap -flt s xxx" find "["}) { !heap -p -a ${userptr}}
to dump file, surround log (.logopen
, .logclose
):
.logopen d:\debug\logs\heap.log; .foreach /ps 4 /ps 7 (userptr {.shell -ci "!heap -flt s xxx" find "["}) { !heap -p -a ${userptr}}; .logclose
there go.
Comments
Post a Comment