本文介绍了原因是ENOMEM from :: popen()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,大多数工作,但我有一个条件,其中调用:: popen()得到一个错误与errno设置为ENOMEM。 :: popen()的手册页引用:: page()的页面,它本身列出了ENOMEM和Linux上的这个简短注释:

I have an application that mostly works, but am having one condition wherein the call to ::popen() gets an error with errno set to ENOMEM. The man page for ::popen() refers you to page for ::fork() which itself lists ENOMEM with this brief comment on Linux:

   The fork() function may fail if:

   ENOMEM Insufficient storage space is available.

我想知道我是真的耗尽内存,还是像文件描述符这样的其他资源?可以fork()给ENOMEM以外的东西,而不是你的系统上的实际内存不足?这是Centos4。

I am wondering if I am really running out of memory, or perhaps some other resource like file descriptors? Can fork() give ENOMEM for something other than running out of actual memory on your system? This is Centos4.

推荐答案

我已经确认ENOMEM是由于没有调用:: pclose )并最终用完文件描述符。

I have confirmed that the ENOMEM resulted from not calling ::pclose() after repeated ::popen() and eventually running out of file descriptors.

这篇关于原因是ENOMEM from :: popen()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-05 08:04