我运行在基于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 *
如果不是您的程序误用了内存,那么它必须是您启动的程序之一,导致该板耗尽内存。 –
你能告诉我检查程序的内存使用情况的命令吗 –