[Mono-list] Heap-Shot with no GUI.
Esben Laursen
hyber at hyber.dk
Fri Nov 19 09:43:28 EST 2010
Den 19-11-2010 15:01, Paolo Molaro skrev:
> On 11/19/10 Esben Laursen wrote:
> <snip>
>> My pam.SshControl.GetData invokes TElSimpleSSHClient:ReceiveText many
>> times to check if there are data comming back. So as I understand it its
>> in the "SBSimpleSSH.TElSimpleSSHClient:ReceiveText" that does not clear
>> a Byte array..
> <snip>
> 1) the allocation summary will tell you how many objects of each type have
> been allocated in the application lifetime and their total size (always
> at the end of the application lifetime). If you use --traces you can see
> which method call sequence lead to the allocations. As such, this data
> can be used to answer questions like:
> *) how much memory did I allocate in the application lifetime?
> *) where am I allocating the objects of any given type?
>
> 2) the heapshot summary (which you can get with: mono
> --profile=log:heapshot ...) will tell you how many objects are present and
> how much memory they use at the time of each successive heap shot. With
> the --traces option you can also see which object types are holding
> references to objects of any other given type. As such this info can be
> used to answer questions like:
> *) at the X point in the lifetime of the application how many
> objects of a given type are present in the heap?
> *) what other objects (or GC handles, or other roots) are
> keeping them alive?
> *) is the number and size of the objects of any given type
> increasing during the application lifetime?
>
Arhhh, that makes sense.. Thanks.
> Heap shot 0 at 4.330 secs: size: 2247136, object count: 21160, class count: 543
> Bytes Count Average Class name
> 827064 122 6779 System.Byte[]
> 43 references from: System.Collections.Hashtable.Slot[]
> 8 references from: System.Net.Sockets.Socket.SocketAsyncResult
> 6 references from: System.IO.FileStream
>
> Which tells us, for example, that 43 of the 122 byte arrays are kept
> alive by the Slot[] arrays in a hashtable. Similarly you could find
> what objects are keeping references to the byte arrays in your app, or
> you may find that at any given point, byte arrays are not significantly
> using much memory, but that you have other objects that you keep alive
> some way and never let go.
>
I think I got it now and I can see why a GUI might come in handy as
scrolling though all that text is problematic.
I executed the command: mono-sgen
--profile=log:heapshot=2000ms,output=/mnt/output.mlpd pam.exe
and now I see:
Heap shot 10 at 331.831 secs: size: 23752824, object count:
22964, class count: 519, roots: 8074
Bytes Count Average Class name
17182136 1117 15382 System.Byte[] (bytes: +16703432,
count: +509)
555 root references (2 pinning)
18 references from: SBSSHClient.TElSSHClient
14 references from:
SBCryptoProvBuiltInSym.TElBuiltInAESSymmetricCrypto
13 references from: SBSSHKeyStorage.TElSSHKey
Sorry that you have to spell it out in wet cardboard, but what is a root
reference and what does pinning mean?
Again I really appreciate that you are helping me so much.. This tool is
far better and more stable than Heap-Shot :-)
--
Esben
More information about the Mono-list
mailing list