【问题标题】:How to turn GCStress on in Windows 7?如何在 Windows 7 中开启 GStress?
【发布时间】:2011-11-25 06:05:50
【问题描述】:

我正在调试GC 堆损坏,并来到我想尝试在 WinDbg + PageHeap + AppVerifier + GStress 下运行程序的步骤。

我在文章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

哪种方式是正确的,或者还有其他正确的方式吗?

【问题讨论】:

  • 我不明白这个问题。你问如何开启,然后说你发现你可以用第一种方法开启它,但那不起作用。第二种方法有效吗?
  • @KierenJohnstone,我没有尝试第二种方法,我不确定这两种方法是否正确。这就是我在网上找到的关于 GStress 的全部内容,我希望精通该主题的人提供建议。我写道,第一种方法很慢,因为我可能认为通过为指定的注册表项设置其他值可能会更快。

标签: .net windows debugging garbage-collection heap-corruption


【解决方案1】:

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
};

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-06-02
    • 1970-01-01
    • 1970-01-01
    • 2011-11-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-08
    相关资源
    最近更新 更多