windbg - !dumpheap vs !strings - different count of entries and different lengths of the reported strings -


please, observe:

0:000> !dumpheap -min 0n100000 -mt 00007fff6c9c16b8 -live          address               mt     size 0000009757e51038 00007fff6c9c16b8   116590      0000009757e6d7c8 00007fff6c9c16b8   121392      0000009757e8b218 00007fff6c9c16b8   160838      0000009757eb2680 00007fff6c9c16b8   160826      0000009757ed9ae0 00007fff6c9c16b8   179332      0000009767e51038 00007fff6c9c16b8   121516      0000009767e6eb08 00007fff6c9c16b8   129002      0000009767e8e318 00007fff6c9c16b8   154506      0000009767eb3ec8 00007fff6c9c16b8   153568      0000009767ed96c8 00007fff6c9c16b8   212294      0000009767f223e0 00007fff6c9c16b8   211356      0000009767f55da0 00007fff6c9c16b8   157274      0000009767f7c420 00007fff6c9c16b8   156336      0000009767fa26f0 00007fff6c9c16b8   215062      0000009767fd6f28 00007fff6c9c16b8   214124      0000009777e71070 00007fff6c9c16b8   130594       statistics:               mt    count    totalsize class name 00007fff6c9c16b8       16      2594610 system.string total 16 objects 0:000> !strings /n:100000 address            gen    length   value --------------------------------------- 0000009767ed96c8   loh    106134                    set deadlock_priority high                  declare @committedcommitstateid int = (select pr... 0000009767f223e0   loh    105665                    set deadlock_priority high                  declare @committedcommitstateid int = (select pr... 0000009767fa26f0   loh    107518                    set deadlock_priority high                  declare @committedcommitstateid int = (select pr... 0000009767fd6f28   loh    107049                    set deadlock_priority high                  declare @committedcommitstateid int = (select pr... --------------------------------------- 4 matching strings 

notice, !dumpheap reports 16 live strings, whereas !strings reports 4.

and lengths different.

why?

i think found answer.

the 4 strings found both !strings , dumpheap have different lengths depending command used:

address            length !dumpheap   length !strings          0000009767ed96c8   212294                106134    0000009767f223e0   211356                105665 0000009767fa26f0   215062                107518 0000009767fd6f28   214124                107049 

where:

212294 = 106134 * 2 + 26 211356 = 105665 * 2 + 26 215062 = 107518 * 2 + 26 214124 = 107049 * 2 + 26 

so, here hypothesis - !dumpheap reports raw size of .net strings - meaning doubles count of characters , adds fields of string object. !strings commands returns count of characters in strings.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -