It appears my express server is juicing all the memory on my sever. I'm only taking a guess at this. I have a process which is running at:
node server.js
This loads a server, receives some data from another server and takes a screen shot. Everything works and it works for a day or so. Then out of nowhere, with no code changes it randomly starts crashing with this error:
internal/child_process.js:366
throw errnoException(err, 'spawn');
^
Error: spawn ENOMEM
at ChildProcess.spawn (internal/child_process.js:366:11)
at Object.spawn (child_process.js:551:9)
I originally had 2 gigs of memory on my server. The process would work and much faster it would give me this error. I bumped up the memory to 3 gigs and it lasted a lot longer, over a day and then it started happening again. Running a check of memory in my server.js file I get this:
{ rss: 30277632,
heapTotal: 20168704,
heapUsed: 12109848,
external: 497984 }
From my command line I run: free -m
total used free shared buffers cached
Mem: 3072 2223 848 3 0 1107
-/+ buffers/cache: 1115 1956
Swap: 0 0 0
Someone in another post suggested adding swap memory. Unfortunately on my server provider this doesn't seem possible.
My guess is that it sucks memory until it runs out then I start getting the error. Is there anyway I can clean out the memory cache from express to clean up some space? I'm not too familiar with this. Any ideas?