是什么导致了Python分割错误?
I am implementing Kosaraju's Strong Connected Component(SCC) graph search algorithm in Python.
我正在用Python实现Kosaraju的强连接组件(SCC)图搜索算法。
The program runs great on small data set, but when I run it on a super-large graph (more than 800,000 nodes), it says "Segmentation Fault".
这个程序在小数据集上运行得很好,但是当我在一个超大的图(超过80万个节点)上运行时,它说的是“分割错误”。
What might be the cause of it? Thank you!
它的原因是什么?谢谢你!
Additional Info: First I got this Error when running on the super-large data set:
附加信息:首先我在超级大数据集上运行时出现了这个错误:
"RuntimeError: maximum recursion depth exceeded in cmp"
Then I reset the recursion limit using
然后我重新设置递归限制
sys.setrecursionlimit(50000)
but got a 'Segmentation fault'
但是有一个“分割错误”
Believe me it's not a infinite loop, it runs correct on relatively smaller data. It is possible the program exhausted the resources?
相信我,它不是一个无限循环,它在相对较小的数据上运行正确。有可能是程序耗尽了资源?
4 个解决方案
#1
58
This happens when a python extension (written in C) tries to access a memory beyond reach.
当python扩展(用C编写)试图访问无法访问的内存时,就会发生这种情况。
You can trace it in following ways.
您可以通过以下方式跟踪它。
- Add
sys.settrace
at the very first line of the code. - 添加系统。在代码的第一行设置settrace。
Use
gdb
as described by Mark in this answer.. At the command prompt按照Mark在这个答案中描述的使用gdb。在命令提示符
gdb python (gdb) run /path/to/script.py ## wait for segfault ## (gdb) backtrace ## stack trace of the c code
更多相关文章
- wget在linux中安装出现错误解决办法
- busybox1.19.3编译错误解决办法
- 打开“保存命令历史记录时遇到错误”时的Matlab错误
- 编译android源码时,jack server 出现out of memory error 错误的
- 如何从PHP的mail()失败中获取额外的错误信息?
- 我如何理解这个编译器错误:“...的多重定义”
- 升级到linux-image-3.13.0-46后安装vmware-tools 9.9出现错误
- 铯:使用自己的OpenStreetMap服务器。:“未能获得图像块”错误
- OCaml编译错误:/ usr / bin / ld:找不到-lstr