了解电子围栏和gdb的输出
当调试因段错误而终止的程序时,电围栏与 gdb 结合将返回:
“ElectricFence 退出:mprotect() 失败:无法分配内存 [线程 0xb0bd4b70 (LWP 5363) 已退出] 程序退出,代码为 0377。
我实际上认为电围栏会更有帮助。这意味着什么?我该如何解读这条信息?似乎没有任何堆栈可供我查看,或者至少 bt
不会返回任何内容。
任何建议将不胜感激。
谢谢!
When debugging a program that terminates with a segfault, electric fence, in conjunction with gdb, returns this:
"ElectricFence Exiting: mprotect() failed: Cannot allocate memory
[Thread 0xb0bd4b70 (LWP 5363) exited]
Program exited with code 0377.
I actually thought electric fence would be more helpful. What does this mean? How can I interpret this piece of information? There doesn't seem to be any stack left that I can look at, or at least bt
won't return anything.
Any suggestion would be really appreciated.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能已经用完了内存映射区域。使用调试分配器时,默认值较低。这可以在运行时通过以下方式进行调整
:或通过将此行添加到 /etc/sysctl.conf 并重新启动:
max_map_count 数字默认为 65530,如有必要,可以增加到 MAX_INT。
有关详细信息,请参阅:
You have probably run out of memory map areas. The default is known to be low when using debug allocators. This can be adjusted at runtime via
or by adding this line to /etc/sysctl.conf and rebooting:
The max_map_count number defaults to 65530 and can be increased as high as MAX_INT if necessary.
For more information see:
ElectricFence 的输出仅意味着它内存不足,无法为您提供帮助。
ElectricFence 会产生极高的内存开销,特别是对于具有大量小堆分配的程序。
如果您使用的是 Linux,请尝试使用 Valgrind。
另请注意,对于因
SIGSEGV
而终止的程序,您的第一步不应使用 ElectricFence 运行它;相反,您应该在调试器下运行该程序并查看它崩溃的位置。The output of ElectricFence simply means that it ran out of memory and can't help you.
ElectricFence imposes extremely high memory overhead, especially for programs with lots of small heap allocations.
If you are on Linux, try Valgrind instead.
Also note, that your first step for a program that dies with
SIGSEGV
should not be running it with ElectricFence; rather you should run the program under debugger and see where it crashes.