I use the follow code to run a PHP script in CLI environment within a 
nodejs daemon.

The script takes the data in stdin performs the calculations and return 
other data to stdout.

The problem is that to run the script with *child_process.spawn* and pipes 
to an *increasing memory usage*. So I must to restart the node app every 
little time.

I would like to keep constant the use of RAM.

In the example I use *cat* command to simulate my php script, but the 
problem persists, *increasing use of memory* proportional to the number of 
cycles in setInterval. And I use *setInterval* to simulate period execution 
of the script.

var spawn = require('child_process').spawn;
var php = spawn('cat');

php.stdout.pipe(process.stdout);
var i = 0;
setInterval(function() {
    php.stdin.write(++i);},10);

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/bf8386be-09e0-4b2c-a34f-86a6c06e29a6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to