pid numbers, open file descriptors, memory limited by resources.
fork (2) manual says when errno.EAGAINshould happen:
[EAGAIN] The system-imposed limit on the total number of processes under
execution would be exceeded. This limit is configuration-dependent.
[EAGAIN] The system-imposed limit MAXUPRC () on the total number of processes
under execution by a single user would be exceeded.
, :
import resource
resource.setrlimit(resource.RLIMIT_NPROC, (20, 20))
, , p.stdin.close(), gnuplot stdin , .. gnuplot . / ( Python 2.7), .
, , .communicate():
from subprocess import Popen, PIPE, STDOUT
p = Popen("gnuplot", stdin=PIPE, stdout=PIPE, stderr=PIPE,
close_fds=True, # to avoid running out of file descriptors
bufsize=-1, # fully buffered (use zero (default) if no p.communicate())
universal_newlines=True) # translate newlines, encode/decode text
out, err = p.communicate("\n".join(['set terminal gif;', contents]))
.communicate() (, ), p.stdin, p.stdout, p.stderr( , gnuplot , EOF flushes ) ( ).
Popen _cleanup() , , .. p.wait() (, ).