我正在调试
GC堆损坏,并且我想尝试在WinDbg PageHeap AppVerifier GCStress下运行该程序.
我在文章Software crash: faulting module mscorwks.dll,version 1.1.4322.2379中发现我可以像这样启用GCStress:
reg.exe add "HKLM\SOFTWARE\Microsoft\.NETFramework" /f /v HeapVerify /t REG_DWORD /d 1 reg.exe add "HKLM\SOFTWARE\Microsoft\.NETFramework" /f /v StressLog /t REG_DWORD /d 1 reg.exe add "HKLM\SOFTWARE\Microsoft\.NETFramework" /f /v GCStress /t REG_DWORD /d 3 reg.exe add "HKLM\SOFTWARE\Microsoft\.NETFramework" /f /v FastGcStress /t REG_DWORD /d 2
(我正在尝试这种方法.它会永远启动程序.我从注册表中删除了最后两个条目以使其工作,可能是方法本身出了问题.)
或者文章Access Violation in .NET 4 Runtime in gc_heap::garbage_collect with no unmanaged modules描述了另一种方法:
(DWORD) StressLog = 1 (DWORD) LogFacility = 0xffffffff (DWORD) StressLogSize = 65536
哪种方式是正确的还是有另一种正确的方法?
我
searched GCStress on Koders.事实证明,最好的理解方法是查看
.NET’s source code:
enum GCStressFlags { GCSTRESS_NONE = 0,GCSTRESS_ALLOC = 1,// GC on all allocations and 'easy' places GCSTRESS_TRANSITION = 2,// GC on transitions to preemtive GC GCSTRESS_INSTR_JIT = 4,// GC on every allowable JITed instruction GCSTRESS_INSTR_NGEN = 8,// GC on every allowable NGEN instruction GCSTRESS_UNIQUE = 16,// GC only on a unique stack trace };