简体   繁体   English

如何知道进程以“内存不足”错误结束?

[英]How to know that a process ends with "out of memory" error?

I have one C++ program that runs another program in a separate process, which does extensive calculations.我有一个 C++ 程序在单独的进程中运行另一个程序,该程序进行大量计算。

How can I know if this other process crashed because of an "out of memory" error?我怎么知道这个其他进程是否因为“内存不足”错误而崩溃?

I use QProcess and QLocalSocket .我使用QProcessQLocalSocket

You cannot get the reason for the crash of a running process executed by QProcess.您无法获取 QProcess 执行的正在运行的进程崩溃的原因。 You can only be informed that it finished (normally or crashed) or that an error occured during execution.您只能被告知它已完成(正常或崩溃)或执行期间发生错误。

All that can be handled by processing QProcess signals所有这些都可以通过处理 QProcess 信号来处理

  1. void QProcess::errorOccurred(QProcess::ProcessError error)
  2. void QProcess::finished(int exitCode, QProcess::ExitStatus exitStatus = NormalExit)

Please, refer to the official documentation .请参考官方文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM