程序在返回0后接收SIGSEGV错误

编程入门 行业动态 更新时间:2024-10-18 14:18:27
本文介绍了程序在返回0后接收SIGSEGV错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 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错误

本文发布于:2023-10-09 05:53:37,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1474887.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:错误   程序   SIGSEGV

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!