- 論壇徽章:
- 0
|
問題解決了。
不過方向和“跟代碼+printk”相反。
我在系統(tǒng)起來之后 寫了個簡單的測試代碼
#include <stdio.h>
#include <pthread.h>
void* thread_info(void)
{
fprintf(stderr,"in thread_info function\n");
}
int main(void)
{
pthread_t thread_id;
int ret;
ret=pthread_create(&thread_id,NULL,(void*)thread_info,NULL);
if(ret != 0){
printf("cannot create new thread,%d:%s",ret,strerror(ret));
return 1;
}
sleep(1);
return 0;
}
發(fā)現(xiàn)還是提示內(nèi)存不足。
懷疑是內(nèi)核中使用的模塊太多的原因。
使用free命令:
total used free shared buffers
Mem: 56576 54376 2200 0 0
Swap: 0 0 0
Total: 56576 54376 2200
可以使用的只有 2200K。
再次確認是內(nèi)核中使用的模塊多的原因。
修改內(nèi)核配置文件,去掉不使用的模塊。
再次free
total used free shared buffers cached
Mem: 56960 27968 28992 0 0 7696
再次測試創(chuàng)建線程,測試通過。
結(jié)論:修改內(nèi)核時,將不用的內(nèi)核模塊去除掉。 |
|