In my universal react application, I'm having a react component containing setInterval in componentWillMount and clearInterval in componentWillUnmount.
Fortunately, componentWillUnmount not called on the server.
componentWillMount(){
this.checker = setInterval(this.checkForSubscription, 2000);
}
componentWillUnmount(){
clearInterval(this.checker);
}
I'm suffering from crashes and memory leaks on my express server. I created heapdumps and analysis those on chrome memory tool.
Unfortunately, got no success to find memory leaks. So, when I remove the setInterval from server side logic by checking typeof for window object. I do not create any crash since then. So, I want to know the code above is the cause of memory leaks and why?