在 Windows 7 上禁用应用程序故障转储
愚蠢的问题:如何防止 Windows 7 存储崩溃应用程序的内存转储?
我正在 C++ 应用程序中试验堆栈分配,因此玩具程序经常崩溃。对于每次崩溃,Windows 都会将内存转储到 %USER%/AppData/Local/CrashDumps。每个大约150MB。我如何禁用此功能?我在互联网上进行了广泛的搜索。我在 Windows 7 上唯一能找到的是系统→高级→启动和恢复→系统故障故障转储,而且我已经禁用了这些。
这并不是什么大问题,只是很烦人,因为它位于我的用户个人资料中。
Silly question: How do I prevent Windows 7 from storing the memory dump of a crashed application?
I'm experimenting with the stack allocation in a C++ application, so the toy program crashes a lot. And for each crash, Windows dumps the memory to the %USER%/AppData/Local/CrashDumps. It's about 150MB each. How do I disable this? I've searched the internet far and wide. The only thing I could find on Windows 7 is System→Advanced→Startup and Recovery→System failure crash dumps, and I already disabled these.
It's not really a big deal, just annoying because it sits in my user profile.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
我认为负责在系统上创建所有这些转储文件的机制是 WER(Windows 错误报告)。您可以阅读如何禁用它:http://www. techrena.net/windows/disable-windows-7-error-reporting/
I think the mechanism responsible for creating all those dump files on your system is WER (Windows Error Reporting). You can read on how to disable it there: http://www.techrena.net/windows/disable-windows-7-error-reporting/
要禁用内存转储文件的创建或创建方式,请打开 regedit 并导航到以下注册表项:
找到此项后,单击它并根据选项更改“CrashDumpEnabled”的值如下:
然后重新启动计算机使其生效。
In order to disable the creation of a memory dump file or how one is created, open regedit and navigate to the following registry key:
Once you've found this key, click on it and change the value of "CrashDumpEnabled" according to the options below:
Then restart your computer for it to take effect.
在
HKEY_CURRENT_USER\Software\Microsoft\Windows\Windows Error Reporting
下,将Disabled
设置为REG_DWORD
等于1
来源:MSDN
Under
HKEY_CURRENT_USER\Software\Microsoft\Windows\Windows Error Reporting
, setDisabled
toREG_DWORD
equal1
Source: MSDN
为您的应用调用
WerAddExcludedApplication
函数Call
WerAddExcludedApplication
fuction for your app禁用错误报告服务(WER - Windows 错误报告)不足以停止写入 %LOCALAPPDATA%\CrashDumps 文件夹。唯一对我有帮助的方法是限制写入文件夹。这可以通过禁止所有用户写入在CrashDumps文件夹的安全设置中完成。或者在CMD中运行命令:
该参数禁止文件夹中的转储文件数量大于零。
Disabling the Error Reporting service (WER - Windows Error Reporting) is not enough to stop writing to the %LOCALAPPDATA%\CrashDumps folder. The only way that helped me was to restrict writing to a folder. This can be done in the security settings of the CrashDumps folder by banning all users from writing. Or run the command in CMD:
The parameter prohibits the number of dump files in the folder from being greater than zero.
我一直无法找到解决方案(始终创建转储),但是您可以使它们更小:(
在 Win 7 和 Win 10 上测试)
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps
DWORD “转储类型”为 0
DWORD "CustomDumpFlags" to 0
DumpType to 0 不会禁用转储,而是将它们设置为“自定义转储”
引用。 : https://learn .microsoft.com/en-us/windows/win32/wer/collecting-user-mode-dumps?redirectedfrom=MSDN
I haven't been able to find a solution (the dump are always being created), however you can make them smaller :
(tested on Win 7 & Win 10)
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps
DWORD "DumpType" to 0
DWORD "CustomDumpFlags" to 0
DumpType to 0 doesn't disable the dumps but set them as "Custom Dump"
ref. : https://learn.microsoft.com/en-us/windows/win32/wer/collecting-user-mode-dumps?redirectedfrom=MSDN