Re: Out of memory: system();

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jun 11, 2004 at 01:45:00PM -0400, Ed K. wrote:
> 
> I must call system(....) about 300,000 times from a process that has 175MB 
> allocated on a computer with only 256MB of RAM. But after about the 5,000th 
> call, i get an out of memory error (errno: 12 Cannot allocate memory) when 
> I call the system function.
> 
> Anyone heard of this? is there something that I should free? why is my 
> 'Committed_AS' at 3TB?

Can you check to see if your sequence is generating a pile 
of orphan/zombie processes.

In general a child process will continue to consume a process slot
until the parent or init gathers up the return status.  See the wait()
system call and perhaps pcntl_wait() in php.

A zombie process has one task left; return it's exit() status to
someone.  Of interest ps can cause an implied wait() system call and
users that have bad scripts might never see their bug.  i.e. check
from a user account not equal to the one running the script if you
can.

Look for & in scripts.... 

If you need to, there are "C" and shell tricks to disconnect from the
controlling (parent) process in ways that init will inherit the
process.  Then init will clean things up for you and toss the value
that wait() returns when the child exits.  However this strategy in a
blind loop can fill up the system with 'too' many processes and things
can bog down as the system swaps badly or gets IO bound.



-- 
	T o m  M i t c h e l l 
	/dev/null the ultimate in secure storage.



[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux