请教高手一个问题 ptmalloc_lock_all陷入死循环
时间:2010-07-09
来源:互联网
做嵌入式开发,里面使用了大量的system调用。经常出现CPU很高,达到90%多,后来通过GDB跟踪栈
发现调到ptmalloc_lock_all就一直出不来。根据网上查找的资料:
bash uses its own malloc implementation. Because of that, ptmalloc_init()
is never called in bash, and the malloc internal variables like main_arena
stay uninitialized. In particular, main_arena.next is a null pointer.
Now, bash calls fork(), which runs the fork prepare handlers in the Hurd,
among them ptmalloc_lock_all. The implementation of that crashes if
main_arena.next is a null pointer, because the for loop doesn't terminate
大致的意思是说一旦main_arena.next 是空指针,循环就永不停止,查看了glibc代码,有个for循环一直找地址,没找到就不退出。
我们这个工程很庞大,想不用system几乎不可能,有没有其他什么解决方法,谢谢大家!
发现调到ptmalloc_lock_all就一直出不来。根据网上查找的资料:
bash uses its own malloc implementation. Because of that, ptmalloc_init()
is never called in bash, and the malloc internal variables like main_arena
stay uninitialized. In particular, main_arena.next is a null pointer.
Now, bash calls fork(), which runs the fork prepare handlers in the Hurd,
among them ptmalloc_lock_all. The implementation of that crashes if
main_arena.next is a null pointer, because the for loop doesn't terminate
大致的意思是说一旦main_arena.next 是空指针,循环就永不停止,查看了glibc代码,有个for循环一直找地址,没找到就不退出。
我们这个工程很庞大,想不用system几乎不可能,有没有其他什么解决方法,谢谢大家!
作者: lishuxi2003 发布时间: 2010-07-09
本帖最后由 没本 于 2010-07-10 00:33 编辑
system发起者的内存脚印(footprint)太大,每次system会按footprint复制一份地址空间(fork的原理),哪怕你只是ls几个文件。因此要用system由一个很小的进程来发起,大进程想system时通过IPC机制通知那个小进程就发起system就行了。
system发起者的内存脚印(footprint)太大,每次system会按footprint复制一份地址空间(fork的原理),哪怕你只是ls几个文件。因此要用system由一个很小的进程来发起,大进程想system时通过IPC机制通知那个小进程就发起system就行了。
作者: 没本 发布时间: 2010-07-09
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28