CreateProcess():“程序太大,无法放入内存”
我目前正在尝试调试我的崩溃处理程序,它是一个外部可执行文件,当我的程序发现未处理的结构化异常时会调用它。我重新编译了崩溃处理程序可执行文件,当我测试时,我收到一条消息:“程序太大,无法放入内存”。
经过一番研究后,我发现这是由未处理的异常过滤器中的 CreateProcess 调用引起的。我发现这篇文章说这个错误消息表明可执行文件已损坏,但是如果我从命令行调用 CrashHandler.exe,则不会收到此类错误。
其他信息:
- 我尝试过重建我的 应用程序和崩溃处理程序 多次调试和 释放模式。
- 我尝试为正在运行的线程提供 2 个数量级的更多堆栈空间。
- 我在另一个已经使用它的应用程序中测试了相同的 CrashHandler.exe,没有任何问题。
- 我尝试使用以前有效的 exe 的早期版本,但结果相同。
- 重新启动系统。
我对 CreateProcess 的调用:
//Fire off the Handler
//HandlerArgs = "CrashHandler.exe arg1 arg2 arg3 etc..."
if(CreateProcess(NULL, HandlerArgs, NULL, NULL, TRUE, CREATE_PRESERVE_CODE_AUTHZ_LEVEL | CREATE_SUSPENDED,
NULL, NULL, &StartupInfo, &NewProcessHandle))
I am currently trying to debug my Crash-Handler, it is an external executable that gets called when my program finds an unhandled structured exception. I recompiled the crash-handler executable, and when I tested, I got a message: "Program too big to fit in memory".
After digging around for a bit, I found that this was being caused by the CreateProcess call within my unhandled exception filter. I found this post that says that this error message indicates that the executable is corrupted, however if I invoke the CrashHandler.exe from the command line, I get no such error.
Other Information:
- I have tried rebuilding my
application and the crash-handler
multiple times in both debug and
release mode. - I have tried giving the running thread 2 orders of magnitude more stack space.
- I tested the same CrashHandler.exe in another application that was already using it, and there were no problems.
- I tried using a previous version of the exe that worked before, but with the same result.
- Restarting the system.
My Call to CreateProcess:
//Fire off the Handler
//HandlerArgs = "CrashHandler.exe arg1 arg2 arg3 etc..."
if(CreateProcess(NULL, HandlerArgs, NULL, NULL, TRUE, CREATE_PRESERVE_CODE_AUTHZ_LEVEL | CREATE_SUSPENDED,
NULL, NULL, &StartupInfo, &NewProcessHandle))
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实证明,我的构建后挂钩之一是从源代码控制存储库复制 exe,而我在源代码控制存储库中的文件实际上是 pdb。在测试时,我直接复制到正在运行的文件夹,然后挂钩将再次复制“损坏的”exe。
Turns out that one of my post-build hooks was copying over the exe from The source control repository, and the file I had in the source control repository was actually the pdb. While testing I was copying directly to my running folder, and then the hook would copy the "corrupted" exe over again.