My application runs on the hero on 5 parallel speakers. The constant load is 500-1500 req / min, so up to 25 req / sec. The problem is that RSS is constantly growing. At the moment, I restart the application manually when the memory reaches a dangerous level (the maximum memory used by the 1st game is 512 MB). The memory layout looks like this (the upper gray axis has a limit of 512 MB):

The moments (in the diagram) when freeing up memory are when I restart the application.
The strange thing is that this only happens with a constant load on the server. When there is, for example, a 2-minute download to the server, then the memory increases, and after that it drops again. It seems that for some reason, the garbage collector does not work correctly (it does not collect garbage until the download on the server is complete and the application is not busy).
What can I do about it? I think this is not a memory leak, because memory is freed when there is no load on the server ...
I have tried so far:
- Manual GC call at 2-minute intervals.
- The setting is max-old-space-size = 300, however nothing happens when the memory reaches 300mb - it is still increasing.
Perhaps there are other options that could help?
Node version 0.10.20
I used the node memwatch package, and I managed to collect the heap difference from the application:
So there must probably be some kind of leak. The largest memory changes from the first fault:
... { "what": "Array", "size_bytes": 9320312, "size": "8.89 mb", "+": 79086, "-": 10215 }, ... { "what": "Closure", "size_bytes": 2638224, "size": "2.52 mb", "+": 36826, "-": 184 }, { "what": "Native", "size_bytes": 21471232, "size": "20.48 mb", "+": 546, "-": 0 }, { "what": "String", "size_bytes": 2068264, "size": "1.97 mb", "+": 36968, "-": 1223 }, ...
What is a Native object (it allocates 20mb mem!)? Could you give me advice on how to investigate what exactly causes the leak?