Identifying Memory Leaks due to object references in Finalize queue
Load the SOS debugger extension for a CLR 4.0 application
.loadby sos clr
1) Identify the objects in finalizeQueue which survived Garbage collection
!fq
SyncBlocks to be cleaned up: 0
MTA Interfaces to be released: 0
STA Interfaces to be released: 0
----------------------------------
generation 0 has 1 finalizable objects (000000008ba63058->000000008ba63060)
generation 1 has 15 finalizable objects (000000008ba62fe0->000000008ba63058)
generation 2 has 14884 finalizable objects (000000008ba45ec0->000000008ba62fe0)
Ready for finalization 0 objects (000000008ba63060->000000008ba63060)
…
000007ff01d58610 2 1024 System.Data.DataTable
000007ff0164e298 4 1120 System.Diagnostics.Process
000007ff01d82738 8 1728 System.Data.DataColumn
000007ff017235a0 16 1920 System.Threading.OverlappedData
000007ff001f1780 28 2464 System.Threading.Thread
000007ff006764b8 52 3744 System.Reflection.Emit.DynamicResolver
000007ff0026fba8 66 4224 System.Threading.ReaderWriterLock
000007ff01e7bb00 314 10048 System.Data.SqlClient.SNIPacket
000007ff01e717e0 546 21840 System.Data.SqlClient.SNIHandle
000007ff01e49f30 314 32656 System.Data.SqlClient.SqlConnection
000007ff02933bf0 302 45904 System.Data.SqlClient.SqlDataAdapter
000007ff0166d240 398 70048 System.Diagnostics.PerformanceCounter
000007ff01e0d0e8 1510 338240 System.Data.SqlClient.SqlCommand
000007ff0057d8f8 11209 358688 System.WeakReference
2) You can also print the details of the finalizable objects for Gen2 using the above details
dd 000000008ba45ec0 000000008ba62fe0
3) Identify the suspected object having leaks
!dumpheap -type System.Data.SqlClient.SqlCommand
Address MT Size
0000000010c43f40 000007ff01e0d0e8 224
0000000010c44020 000007ff01e0d0e8 224
0000000010c44198 000007ff01e0d0e8 224
0000000010c44278 000007ff01e0d0e8 224
0000000010c444e8 000007ff01e0d0e8 224
4) Identify the GC roots for the objects. It contains the call stack
!gcroot 0000000010c43f40
Scan Thread 15 OSTHread 1bc0
Scan Thread 16 OSTHread 1d74
Scan Thread 19 OSTHread 3200
Scan Thread 17 OSTHread 21f0
Scan Thread 18 OSTHread 3564
Scan Thread 20 OSTHread 322c
Scan Thread 21 OSTHread 2b80
Scan Thread 28 OSTHread 2e5c
Scan Thread 29 OSTHread 35d0
Scan Thread 30 OSTHread 3bc
Scan Thread 31 OSTHread 2770
Scan Thread 33 OSTHread 19b4
Scan Thread 34 OSTHread 534
Scan Thread 35 OSTHread 3280
Scan Thread 36 OSTHread 1908
Scan Thread 37 OSTHread 344c
Scan Thread 38 OSTHread 13d4
Scan Thread 39 OSTHread 21d4
Scan Thread 40 OSTHread 31a4
DOMAIN(0000000001AB88B0):HANDLE(Pinned):1217c0:Root: 000000002070f040(System.Object[])->
00000000108c9ac0(System.Collections.Hashtable+SyncHashtable)->
00000000108c91e8(System.Collections.Hashtable)->
000000001171efc0(System.Collections.Hashtable+bucket[])->
00000000120a3768(System.Collections.Hashtable)->
00000000120a37c0(System.Collections.Hashtable+bucket[])->
00000000120a3820(System.Collections.Hashtable)->
00000000120fa180(System.Collections.Hashtable+bucket[])->
00000000120b7200(System.Collections.Generic.Dictionary`2[[ATOM.AS.CobolBase.CobolProgramName, ATOM.AS.CobolBase],[ATOM.AS.CobolBase.CobolProgram, ATOM.AS.CobolBase]])->
00000000120b7360(System.Collections.Generic.Dictionary`2+Entry[[ATOM.AS.CobolBase.CobolProgramName, ATOM.AS.CobolBase],[ATOM.AS.CobolBase.CobolProgram, ATOM.AS.CobolBase]][])->
00000000120b7258(ATOM.AS.CobolBase.CobolProgram)->
00000000120b7310(System.Collections.Generic.List`1[[ATOM.AS.CobolBase.IProgramEvents, ATOM.AS.CobolBase]])->
0000000019b0f918(System.Object[])->
0000000019b0f590(ATOM.AS.DataAccess.DataAccess)->
0000000019b13c40(ATOM.AS.DataAccess.ProviderSQL)->
0000000019b13d70(System.Data.SqlClient.SqlCommand)->
0000000019b15978(System.Data.SqlClient.SqlCommand+CachedAsyncState)
@2011, copyright Vamsidhar Tokala
Load the SOS debugger extension for a CLR 4.0 application
.loadby sos clr
1) Identify the objects in finalizeQueue which survived Garbage collection
!fq
SyncBlocks to be cleaned up: 0
MTA Interfaces to be released: 0
STA Interfaces to be released: 0
----------------------------------
generation 0 has 1 finalizable objects (000000008ba63058->000000008ba63060)
generation 1 has 15 finalizable objects (000000008ba62fe0->000000008ba63058)
generation 2 has 14884 finalizable objects (000000008ba45ec0->000000008ba62fe0)
Ready for finalization 0 objects (000000008ba63060->000000008ba63060)
…
000007ff01d58610 2 1024 System.Data.DataTable
000007ff0164e298 4 1120 System.Diagnostics.Process
000007ff01d82738 8 1728 System.Data.DataColumn
000007ff017235a0 16 1920 System.Threading.OverlappedData
000007ff001f1780 28 2464 System.Threading.Thread
000007ff006764b8 52 3744 System.Reflection.Emit.DynamicResolver
000007ff0026fba8 66 4224 System.Threading.ReaderWriterLock
000007ff01e7bb00 314 10048 System.Data.SqlClient.SNIPacket
000007ff01e717e0 546 21840 System.Data.SqlClient.SNIHandle
000007ff01e49f30 314 32656 System.Data.SqlClient.SqlConnection
000007ff02933bf0 302 45904 System.Data.SqlClient.SqlDataAdapter
000007ff0166d240 398 70048 System.Diagnostics.PerformanceCounter
000007ff01e0d0e8 1510 338240 System.Data.SqlClient.SqlCommand
000007ff0057d8f8 11209 358688 System.WeakReference
2) You can also print the details of the finalizable objects for Gen2 using the above details
dd 000000008ba45ec0 000000008ba62fe0
3) Identify the suspected object having leaks
!dumpheap -type System.Data.SqlClient.SqlCommand
Address MT Size
0000000010c43f40 000007ff01e0d0e8 224
0000000010c44020 000007ff01e0d0e8 224
0000000010c44198 000007ff01e0d0e8 224
0000000010c44278 000007ff01e0d0e8 224
0000000010c444e8 000007ff01e0d0e8 224
4) Identify the GC roots for the objects. It contains the call stack
!gcroot 0000000010c43f40
Scan Thread 15 OSTHread 1bc0
Scan Thread 16 OSTHread 1d74
Scan Thread 19 OSTHread 3200
Scan Thread 17 OSTHread 21f0
Scan Thread 18 OSTHread 3564
Scan Thread 20 OSTHread 322c
Scan Thread 21 OSTHread 2b80
Scan Thread 28 OSTHread 2e5c
Scan Thread 29 OSTHread 35d0
Scan Thread 30 OSTHread 3bc
Scan Thread 31 OSTHread 2770
Scan Thread 33 OSTHread 19b4
Scan Thread 34 OSTHread 534
Scan Thread 35 OSTHread 3280
Scan Thread 36 OSTHread 1908
Scan Thread 37 OSTHread 344c
Scan Thread 38 OSTHread 13d4
Scan Thread 39 OSTHread 21d4
Scan Thread 40 OSTHread 31a4
DOMAIN(0000000001AB88B0):HANDLE(Pinned):1217c0:Root: 000000002070f040(System.Object[])->
00000000108c9ac0(System.Collections.Hashtable+SyncHashtable)->
00000000108c91e8(System.Collections.Hashtable)->
000000001171efc0(System.Collections.Hashtable+bucket[])->
00000000120a3768(System.Collections.Hashtable)->
00000000120a37c0(System.Collections.Hashtable+bucket[])->
00000000120a3820(System.Collections.Hashtable)->
00000000120fa180(System.Collections.Hashtable+bucket[])->
00000000120b7200(System.Collections.Generic.Dictionary`2[[ATOM.AS.CobolBase.CobolProgramName, ATOM.AS.CobolBase],[ATOM.AS.CobolBase.CobolProgram, ATOM.AS.CobolBase]])->
00000000120b7360(System.Collections.Generic.Dictionary`2+Entry[[ATOM.AS.CobolBase.CobolProgramName, ATOM.AS.CobolBase],[ATOM.AS.CobolBase.CobolProgram, ATOM.AS.CobolBase]][])->
00000000120b7258(ATOM.AS.CobolBase.CobolProgram)->
00000000120b7310(System.Collections.Generic.List`1[[ATOM.AS.CobolBase.IProgramEvents, ATOM.AS.CobolBase]])->
0000000019b0f918(System.Object[])->
0000000019b0f590(ATOM.AS.DataAccess.DataAccess)->
0000000019b13c40(ATOM.AS.DataAccess.ProviderSQL)->
0000000019b13d70(System.Data.SqlClient.SqlCommand)->
0000000019b15978(System.Data.SqlClient.SqlCommand+CachedAsyncState)
@2011, copyright Vamsidhar Tokala
No comments:
Post a Comment