程序在返回0后接收SIGSEGV错误 [英] Program receives SIGSEGV error after return 0
问题描述
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7b8bc26 in std::basic_filebuf<char, std::char_traits<char> >::_M_terminate_output() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
(gdb) where
#0 0x00007ffff7b8bc26 in std::basic_filebuf<char, std::char_traits<char> >::_M_terminate_output() ()
from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#1 0x00007ffff7b8c6a2 in std::basic_filebuf<char, std::char_traits<char>>::close() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#2 0x00007ffff7b8cb2a in std::basic_ofstream<char, std::char_traits<char> >::~basic_ofstream() ()
from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3 0x0000000000403e02 in main (argc=2, argv=0x7fffffffe1c8)
at main.cpp:630
我在程序执行后遇到这个错误, 0;已被执行。
I am facing this error after program execution and after "return 0;" has been executed.
我使用了STL的向量。只有当输入文件大小很高(我在图形中有大约10000个节点)时才会抛出此错误。
I have used vectors from STL. This error is thrown only when input file size is very high (I am having around 10000 nodes in graph)
此外,我无法将输出写入文件。目前我已经评论过那部分。
Also, I am not able to write output to a file. Currently I have commented that part.
请帮助我解决问题。
我使用的是Ubuntu 12.10 64位。
Please help me with issue. I am using Ubuntu 12.10 64 bit.
推荐答案
从 code>可能是由(至少)造成的:
Errors after returning from main
can be caused by (at least):
- dodgy
atexit
处理程序;
- dodgy
atexit
handlers; or - memory corruption of some description.
在这两种情况下,后者因此您应该在动态内存使用分析工具(如 valgrind
)下运行您的代码。您对于导致问题的大型载体的描述也似乎支持此争论。
Of those two, it's more likely to be the latter so you should run your code under a dynamic memory-use analysis tool, like valgrind
. Your description of large vectors causing the problem also seems to support this contention.
这篇关于程序在返回0后接收SIGSEGV错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!