我運行在基於ARM的板下面的代碼:SH:內存不足的系統調用
sh: out of memory
StartStreamer: command=[/usr/bin/gst-launch-0.10 imxv4l2src ! imxv4l2sink &], status:256
Segmentation fault
Rebooting:35584
StopStreamer: command=[killall gst-launch-0.10], status = 11
Rebooting:11
Loop Count:26
sh: relocation error: sh: symbol free, version GLIBC_2.4 not defined in file libc.so.6 with link time reference
sh: relocation error: sh: symbol free, version GLIBC_2.4 not defined in file libc.so.6 with link time reference
StartStreamer: command=[/usr/bin/gst-launch-0.10 imxv4l2src ! imxv4l2sink &], status:32512
Rebooting:11
killall: gst-launch-0.10: no process killed
StopStreamer: command=[killall gst-launch-0.10], status = 11
Rebooting:11
Loop Count:27
StartStreamer: command=[/usr/bin/gst-launch-0.10 imxv4l2src ! imxv4l2sink &], status:32512
Rebooting:32512
可以:
void MainLoop()
{
char command[256];
int ret = 0;
int loopCount = 0;
while(1)
{
memset(command, '\0', sizeof(command));
sprintf(command, "/usr/bin/gst-launch-0.10 imxv4l2src ! imxv4l2sink &");
ret = system(command);
printf("StartStreamer: command=[%s], status:%d\n", command, ret);
if (ret != 0)
{
ret = system("reboot");
printf("Rebooting:%d\n", ret);
}
sleep(15);
memset(command, '\0', sizeof(command));
sprintf(command, "killall gst-launch-0.10");
ret = system(command);
printf("StopStreamer: command=[%s], status = %d\n", command, ret);
if (ret != 0)
{
ret = system("reboot");
printf("Rebooting:%d\n", ret);
}
sleep(15);
loopCount++;
printf("Loop Count:%d\n", loopCount);
}
}
運行一些隨機循環我收到以下錯誤後你請告訴我什麼是「sh:內存不足」,意思是說,是因爲系統調用太多。而且,它的奇怪的是我得到glibc重定位錯誤...
我已經從C應用程序修改爲Bash sc RIPT:
#!/bin/ash
count=0
while [ true ];do
echo "Starting Streamer"
/usr/bin/gst-launch-0.10 imxv4l2src ! imxv4l2sink &
sleep 15
echo "Stopping Streamer"
killall gst-launch-0.10
sleep 15
count=$((count+1))
echo $count
done
而對於一些循環,我得到以下錯誤後運行:
*錯誤/bin/sh': double free or corruption (out): 0x0028ebf8 *** *** Error in
/bin/sh的':的malloc():內存破壞:0x0028edf8 *
如果不是您的程序誤用了內存,那麼它必須是您啓動的程序之一,導致該板耗盡內存。 –
你能告訴我檢查程序的內存使用情況的命令嗎 –