- 论坛徽章:
- 0
|
做嵌入式开发,里面使用了大量的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几乎不可能,有没有其他什么解决方法,谢谢大家! |
|