我正在寻找高内存问题的转储文件。该转储文件中突出的一件事是超过 300,000 个 DataRow 对象。我们对存储在内存中的 DataTable 对象的 sql 数据库运行查询。我想知道是什么查询负责创建这么多 DataRow 对象。我可以在 DataRow 和 DataTable 对象中看到各种字段,但无法弄清楚如何找到相关的 SqlCommand 对象,因为这应该让我可以访问 CommandText 并因此访问查询。有人可以帮我弄清楚如何获取 SqlCommand 对象吗?
0:000> !do 00000001003c0b98
Name: System.Data.DataRow
MethodTable: 000007fef5f4b880
EEClass: 000007fef5dc4348
Size: 96(0x60) bytes
File: C:\Windows\Microsoft.Net\assembly\GAC_64\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll
Fields:
MT Field Offset Type VT Attr Value Name
000007fef5f4a548 4000752 8 ...em.Data.DataTable 0 instance 00000001601a6610 _table
000007fef5f4c100 4000753 10 ...aColumnCollection 0 instance 00000001601a6900 _columns
000007fef8a1c9d0 4000754 38 System.Int32 1 instance 326255 oldRecord
000007fef8a1c9d0 4000755 3c System.Int32 1 instance 326255 newRecord
000007fef8a1c9d0 4000756 40 System.Int32 1 instance -1 tempRecord
000007fef8a37fa8 4000757 30 System.Int64 1 instance 326256 _rowID
000007fef64408b8 4000758 44 System.Int32 1 instance 0 _action
000007fef8a1d800 4000759 54 System.Boolean 1 instance 0 inChangingEvent
000007fef8a1d800 400075a 55 System.Boolean 1 instance 0 inDeletingEvent
000007fef8a1d800 400075b 56 System.Boolean 1 instance 0 inCascade
000007fef5f4b768 400075c 18 ...m.Data.DataColumn 0 instance 0000000000000000 _lastChangedColumn
000007fef8a1c9d0 400075d 48 System.Int32 1 instance 0 _countColumnChange
000007fef6462910 400075e 20 ...em.Data.DataError 0 instance 0000000000000000 error
000007fef8a15c40 400075f 28 System.Object 0 instance 0000000000000000 _element
000007fef8a1c9d0 4000760 4c System.Int32 1 instance 11865584 _rbTreeNodeId
000007fef8a1c9d0 4000762 50 System.Int32 1 instance 753591 ObjectID
000007fef8a1c9d0 4000761 548 System.Int32 1 shared static _objectTypeCount
>> Domain:Value 00000000014d8430:NotInit 0000000002e08b30:NotInit <<
0:000> !do 00000001601a6610
Name: System.Data.DataTable
MethodTable: 000007fef5f4a548
EEClass: 000007fef5dc4110
Size: 512(0x200) bytes
File: C:\Windows\Microsoft.Net\assembly\GAC_64\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll
Fields:
MT Field Offset Type VT Attr Value Name
000007fef7d0fa50 40003b7 8 ...ponentModel.ISite 0 instance 0000000000000000 site
000007fef7d0e708 40003b8 10 ....EventHandlerList 0 instance 0000000000000000 events
000007fef8a15c40 40003b6 3d0 System.Object 0 shared static EventDisposed
>> Domain:Value 00000000014d8430:NotInit 0000000002e08b30:NotInit <<
000007fef5f49740 40007d7 18 System.Data.DataSet 0 instance 00000001601a5f20 dataSet
000007fef5f4bbb8 40007d8 20 System.Data.DataView 0 instance 0000000000000000 defaultView
000007fef8a37fa8 40007d9 1a0 System.Int64 1 instance 2849445 nextRowID
000007fef5f4c210 40007da 28 ...DataRowCollection 0 instance 00000001601a6aa0 rowCollection
000007fef5f4c100 40007db 30 ...aColumnCollection 0 instance 00000001601a6900 columnCollection
000007fef5f4c188 40007dc 38 ...straintCollection 0 instance 00000001601a6a40 constraintCollection
000007fef8a1c9d0 40007dd 1a8 System.Int32 1 instance 2 elementColumnCount
000007fef5f4aeb8 40007de 40 ...elationCollection 0 instance 0000000000000000 parentRelationsCollection
000007fef5f4aeb8 40007df 48 ...elationCollection 0 instance 0000000000000000 childRelationsCollection
000007fef5f4c0a0 40007e0 50 ...ata.RecordManager 0 instance 00000001601a68a0 recordManager
0000000000000000 40007e1 58 0 instance 00000001601a7070 indexes
0000000000000000 40007e2 60 0 instance 0000000000000000 shadowIndexes
000007fef8a1c9d0 40007e3 1ac System.Int32 1 instance 0 shadowCount
000007fef6465340 40007e4 68 ...ropertyCollection 0 instance 0000000000000000 extendedProperties
000007fef8a16ae8 40007e5 70 System.String 0 instance 000000017fb08258 tableName
000007fef8a16ae8 40007e6 78 System.String 0 instance 0000000000000000 tableNamespace
000007fef8a16ae8 40007e7 80 System.String 0 instance 00000000ffb00488 tablePrefix
000007fef5f4ee58 40007e8 88 ...ta.DataExpression 0 instance 0000000000000000 displayExpression
000007fef8a1d800 40007e9 1c4 System.Boolean 1 instance 1 fNestedInDataset
000007fef8a23fd0 40007ea 90 ...ation.CultureInfo 0 instance 0000000120122eb8 _culture
000007fef8a1d800 40007eb 1c5 System.Boolean 1 instance 0 _cultureUserSet
000007fef8a1d588 40007ec 98 ...ation.CompareInfo 0 instance 0000000000000000 _compareInfo
0000000000000000 40007ed 1b0 System.Int32 1 instance 25 _compareFlags
0000000000000000 40007ee a0 0 instance 0000000120122eb8 _formatProvider
0000000000000000 40007ef a8 0 instance 00000001601a70e8 _hashCodeProvider
000007fef8a1d800 40007f0 1c6 System.Boolean 1 instance 0 _caseSensitive
000007fef8a1d800 40007f1 1c7 System.Boolean 1 instance 0 _caseSensitiveUserSet
000007fef8a16ae8 40007f2 b0 System.String 0 instance 0000000000000000 encodedTableName
000007fef5f4b768 40007f3 b8 ...m.Data.DataColumn 0 instance 0000000000000000 xmlText
000007fef5f4b768 40007f4 c0 ...m.Data.DataColumn 0 instance 0000000000000000 _colUnique
000007fef8a1d800 40007f5 1c8 System.Boolean 1 instance 0 textOnly
000007fef8a383d0 40007f6 1d8 System.Decimal 1 instance 00000001601a67e8 minOccurs
000007fef8a383d0 40007f7 1e8 System.Decimal 1 instance 00000001601a67f8 maxOccurs
000007fef8a1d800 40007f8 1c9 System.Boolean 1 instance 0 repeatableElement
000007fef8a15c40 40007f9 c8 System.Object 0 instance 0000000000000000 typeName
000007fef6463058 40007fd d0 ....UniqueConstraint 0 instance 0000000000000000 primaryKey
000007fef5f4b8e0 40007ff d8 ...Data.IndexField[] 0 instance 000000017fb683b8 _primaryIndex
000007fef8a1aff0 4000800 e0 System.Object[] 0 instance 0000000000000000 delayedSetPrimaryKey
000007fef5f4cbf0 4000801 e8 System.Data.Index 0 instance 0000000000000000 loadIndex
000007fef5f4cbf0 4000802 f0 System.Data.Index 0 instance 0000000000000000 loadIndexwithOriginalAdded
000007fef5f4cbf0 4000803 f8 System.Data.Index 0 instance 0000000000000000 loadIndexwithCurrentDeleted
000007fef8a1c9d0 4000804 1b4 System.Int32 1 instance 0 _suspendIndexEvents
000007fef8a1d800 4000805 1ca System.Boolean 1 instance 1 savedEnforceConstraints
000007fef8a1d800 4000806 1cb System.Boolean 1 instance 0 inDataLoad
000007fef8a1d800 4000807 1cc System.Boolean 1 instance 1 initialLoad
000007fef8a1d800 4000808 1cd System.Boolean 1 instance 0 schemaLoading
000007fef8a1d800 4000809 1ce System.Boolean 1 instance 1 enforceConstraints
000007fef8a1d800 400080a 1cf System.Boolean 1 instance 0 _suspendEnforceConstraints
000007fef8a1d800 400080b 1d0 System.Boolean 1 instance 0 fInitInProgress
000007fef8a1d800 400080c 1d1 System.Boolean 1 instance 0 inLoad
000007fef8a1d800 400080d 1d2 System.Boolean 1 instance 0 fInLoadDiffgram
000007fef8a1c350 400080e 1d3 System.Byte 1 instance 2 _isTypedDataTable
000007fef8a1aff0 400080f 100 System.Object[] 0 instance 0000000000000000 EmptyDataRowArray
000007fef7d0db28 4000810 108 ...criptorCollection 0 instance 0000000000000000 propertyDescriptorCollectionCache
000007fef8a1aff0 4000812 110 System.Object[] 0 instance 000000017fb683d0 _nestedParentRelations
0000000000000000 4000813 118 0 instance 0000000000000000 dependentColumns
000007fef8a1d800 4000814 1d4 System.Boolean 1 instance 0 mergingData
000007fef6464140 4000815 120 ...hangeEventHandler 0 instance 0000000000000000 onRowChangedDelegate
000007fef6464140 4000816 128 ...hangeEventHandler 0 instance 0000000000000000 onRowChangingDelegate
000007fef6464140 4000817 130 ...hangeEventHandler 0 instance 0000000000000000 onRowDeletingDelegate
000007fef6464140 4000818 138 ...hangeEventHandler 0 instance 0000000000000000 onRowDeletedDelegate
000007fef6462898 4000819 140 ...hangeEventHandler 0 instance 0000000000000000 onColumnChangedDelegate
000007fef6462898 400081a 148 ...hangeEventHandler 0 instance 0000000000000000 onColumnChangingDelegate
000007fef6464678 400081b 150 ...ClearEventHandler 0 instance 0000000000000000 onTableClearingDelegate
000007fef6464678 400081c 158 ...ClearEventHandler 0 instance 0000000000000000 onTableClearedDelegate
000007fef6464700 400081d 160 ...ewRowEventHandler 0 instance 0000000000000000 onTableNewRowDelegate
000007fef7cf0790 400081e 168 ...angedEventHandler 0 instance 0000000000000000 onPropertyChangingDelegate
000007fef8a2e1d8 400081f 170 System.EventHandler 0 instance 0000000000000000 onInitialized
000007fef5f4cc78 4000820 178 ...ta.DataRowBuilder 0 instance 00000001601a7098 rowBuilder
0000000000000000 4000821 180 0 instance 00000001601a6810 delayedViews
0000000000000000 4000822 188 0 instance 00000001601a6838 _dataViewListeners
000007fef8a21db0 4000823 190 ...ections.Hashtable 0 instance 0000000000000000 rowDiffId
000007fef8a233f0 4000824 198 ....ReaderWriterLock 0 instance 00000001601a6860 indexesLock
000007fef8a1c9d0 4000825 1b8 System.Int32 1 instance -1 ukColumnPositionForInference
000007fef6440a70 4000826 1bc System.Int32 1 instance 0 _remotingFormat
000007fef8a1c9d0 4000828 1c0 System.Int32 1 instance 3838 _objectID
000007fef8a1c960 40007fa 290 System.Int32[] 0 shared static zeroIntegers
>> Domain:Value 00000000014d8430:NotInit 0000000002e08b30:000000017fb68360 <<
000007fef8a1aff0 40007fb 298 System.Object[] 0 shared static zeroColumns
>> Domain:Value 00000000014d8430:NotInit 0000000002e08b30:000000017fb68378 <<
000007fef8a1aff0 40007fc 2a0 System.Object[] 0 shared static zeroRows
>> Domain:Value 00000000014d8430:NotInit 0000000002e08b30:000000017fb68398 <<
000007fef5f4b8e0 40007fe 2a8 ...Data.IndexField[] 0 shared static zeroIndexField
>> Domain:Value 00000000014d8430:NotInit 0000000002e08b30:000000017fb683b8 <<
000007fef8a1aff0 4000811 2b0 System.Object[] 0 shared static EmptyArrayDataRelation
>> Domain:Value 00000000014d8430:NotInit 0000000002e08b30:000000017fb683d0 <<
000007fef8a1c9d0 4000827 558 System.Int32 1 shared static _objectTypeCount
>> Domain:Value 00000000014d8430:NotInit 0000000002e08b30:3851 <<