I have an Express.js web app which is constantly breaking because of memory problems:
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap
out of memory
When I start the service, the memory usage is about 170Mb (reported by htop as RES memory). Then I start throwing request at it, and the memory start rising.
I'm using memwatch
to try to track the problem in what looks like a memory leak, but a memwatch.HeapDiff()
reports something like:
{ before: { nodes: 2093729, size_bytes: 197165296, size: '188.03 mb' },
after: { nodes: 2491264, size_bytes: 232097040, size: '221.34 mb' },
...
... where I understand that the app is using 221.34mb for the heap; but with htop
the memory usage is about 2GB when it breaks.
The question is, if my assumptions are right, what could be using non-heap memory that is still reported by htop as RES memory?