I recently started my first project with node.js, and I can definitely say that I love him. Very powerful with all modules; however, it seems that I have a “small” memory leak, due to which my server crashes after about an hour (gaining 99-100% of the CPU). I have been trying to solve this problem for a while.
Fortunately, after a short search, I found a popular tool called memwatch. Of course, I installed the module and began to register the use / storage of the memory of my server.
In the end, looking through the magazines, I found a probable reason.
{
"what": "String",
"size_bytes": 9421368,
"size": "8.98 mb",
"+": 16635,
"-": 533
}
Of course, in thirty seconds this little bugger coped with an increase of 9 mb (very unusual). It's nice and dandy to know that my memory leak seems to be type string, but where exactly am I coming from here? Is there a way to get more accurate results?
I looked at my code, but there really isn’t in my code stringthat can grow that way. Is there a chance that this line is not part of my code and is not part of a node or Socket.IO module?
source
share