0

I built web app to display sensors and charts in real time. it works well, but it has memory leak problem. when i start it, it took 200M memory only. but after 10 hours, it became 2G. I tried to fix , but seems it's from chrome browser. when i close the chrome tab, memory was released. so I am finding to release memory automatically. is there anyone who know this?

I noticed there is the way to restart app when memory size exceeds max size. pm2 start big-array.js --max-memory-restart 20M but it will restart app. I want to run this app without any restarting or refresh browser.

Lee Bin
  • 49
  • 3
  • 10
  • Does this answer your question? [memory limit in Node.js (and chrome V8)](https://stackoverflow.com/questions/7193959/memory-limit-in-node-js-and-chrome-v8) – xdeepakv Mar 29 '20 at 12:57
  • 1
    for node js, the size limit it 2GB, u can set --max-old-space-size=8192 but your app will be slow down. You performance analysis , and find the exact issue. `node --max-old-space-size=8192 app.js` – xdeepakv Mar 29 '20 at 12:58
  • if i add it, memory will be released automatically? it will not stop the app running? thank you – Lee Bin Mar 29 '20 at 13:02
  • it will force GC to clean, meaning force clean. and cleaning is slow process. so it will slow down your app – xdeepakv Mar 29 '20 at 13:06
  • yes. if it force GC to clean, web app will stop ? or it will keep to run even slow process ? thanks :) – Lee Bin Mar 29 '20 at 14:20

0 Answers0