Causes for ENOMEM from ::popen()

僤鯓⒐⒋嵵緔 提交于 2019-12-22 17:40:07

问题


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.

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.


回答1:


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



来源:https://stackoverflow.com/questions/6419740/causes-for-enomem-from-popen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!