My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

Node Garbage Collection in SSR React App

Lionel's photo
Lionel
·Oct 16, 2017

I have an _Application _running continuously using PM2.

It is a server side rendered React Application, that hydrate the redux store using a similar technique like this one.

After deploy the Application, the memory in pm2 ls is near 100Mb like in the screenshot:

When the Application continues running in time, the memory grows.

Since for some views, the application wait to fetch data dispatching needs actions I started debugging with _Chrome _and its dedicated DevTools for Node. When I refresh one of these views taking two Heap Snapshots and showing only the allocated Objects between them, I see lot of Objects part of the Redux store.

As what I understand, those (sometimes big) Objects wasn't GC'ed so i wonder if there's a way improve this logic of the _Application _since ones the store (an it's Objects ) is in the client we won't need'em anymore.