Python 进程完成,退出代码 -1073741571

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20629027/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-18 20:52:52  来源:igfitidea点击:

Process finished with exit code -1073741571

pythonrecursionerror-code

提问by Salvador Dali

I have a recursion function which is finding Eulerian Path. I do not think that the definition of the function is relevant (but if someone thinks so, I will paste it as well).

我有一个递归函数,它正在寻找欧拉路径。我不认为函数的定义是相关的(但如果有人这么认为,我也会粘贴它)。

The problem is that when I am running the function with a big graph, I receive the following well known error: RuntimeError: maximum recursion depth exceeded in cmp

问题是,当我运行带有大图的函数时,我收到以下众所周知的错误:RuntimeError:cmp 中超出了最大递归深度

Even without the above-mentioned question, I know that I need to increase recursion limit with the following commands

即使没有上述问题,我知道我需要使用以下命令增加递归限制

import sys
sys.setrecursionlimit(5000)

The problem is that when no matter what number am I using I either get the Maximum recursion error or my program just halts with no output on the screen but: Process finished with exit code -1073741571. I tried to google for this code and the only problem I was able to find was the problem in Ruby. Any idea how I can overcome this problem.

问题是,无论我使用什么数字,我要么得到最大递归错误,要么我的程序只是停止而屏幕上没有输出但是:进程已完成,退出代码为 -1073741571。我试图用谷歌搜索这段代码,我能找到的唯一问题是 Ruby 中的问题。知道我如何克服这个问题。

If this is relevant I am on Windows 8 64 bit, I have plenty of RAM and I have 64bit python.

如果这是相关的,我在 Windows 8 64 位上,我有足够的 RAM,我有 64 位 python。

Just because for some reason this question received some attention recently, I want to highlight that I was not able to find solution to the problem. After hopelessly trying to solve the problem I gave up and rewrote it without recursion. Also it was annoying, but I spent much less time rewriting the whole algorithm, than I spent investigating this problem. I also want to mention that I do not have previous recursion code, so I will not be able to replicate the problem.

仅仅因为出于某种原因这个问题最近受到了一些关注,我想强调一下我无法找到问题的解决方案。在绝望地试图解决这个问题之后,我放弃了并没有递归地重写了它。这也很烦人,但我重写整个算法的时间比我研究这个问题的时间少得多。我还想提一下,我没有以前的递归代码,所以我将无法复制这个问题。

回答by reteptilian

That is the signed integer representation of Microsoft's "stack overflow/stack exhaustion" error code 0xC00000FD.

那是 Microsoft 的“堆栈溢出/堆栈耗尽”错误代码 0xC00000FD 的有符号整数表示。

You might try increasing your executable's stack size as described in the answer here: How to overcome Stack Size issue with Visual Studio (running C codes with big array)

您可以尝试按照以下答案中的说明增加可执行文件的堆栈大小: 如何使用 Visual Studio 解决堆栈大小问题(使用大数组运行 C 代码)

Anytime you see strange, large negative exit codes in windows, convert them to hex and then look them up in the ntstatus error codes http://msdn.microsoft.com/en-us/library/cc704588.aspx

任何时候你在 windows 中看到奇怪的、大的负退出代码,将它们转换为十六进制,然后在 ntstatus 错误代码中查找它们http://msdn.microsoft.com/en-us/library/cc704588.aspx

回答by Juan Pablo VEGA

You could use something like:

你可以使用类似的东西:

if __name__ == '__main__':
    sys.setrecursionlimit(100000)
    threading.stack_size(200000000)
    thread = threading.Thread(target=your_code)
    thread.start()

This solved both my recursion limitation and my heap size limitation.

这解决了我的递归限制和堆大小限制。