F
F
Findoss2018-09-20 21:24:06
Node.js
Findoss, 2018-09-20 21:24:06

How to limit memory usage for node.js processes?

Good day, I'm trying to remotely build a project on vue.js.
Hosting (Heroku) on a free plan gives 500 RAM, if you use more then the process kills.
I tried to start processes with

node --max_old_space_size=400 node_modules/.bin/vue-cli-service build
but it doesn't work.
In Heroku logs
heroku[web.1]: Process running mem=800M(156.3%)
heroku[web.1]: Error R14 (Memory quota exceeded)
heroku[web.1]: Process running mem=1126M(220.0%)
heroku[web.1]: Error R15 (Memory quota vastly exceeded)
heroku[web.1]: Stopping process with SIGKILL

more details about error R15
proposed solution from Heroku
package.json
"dependencies": {
    "@vue/cli-service": "^3.0.3",
}

"engines": {
  "node": "9.9.0",
  "npm": "5.6.0"
},

On the local machine, the assembly runs without any problems.
Of course, there is an option to build locally, but I don’t want to clog the repository.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
Findoss, 2018-09-21
@Findoss

Huroku allocates up to 1.5GB of RAM to the build process. It was enough to transfer the vue.js assembly to the hook script after installing the
package.json dependencies

"scripts": {
  "build": "vue-cli-service build",
  "postinstall": "npm run build"
}

V
VoidVolker, 2018-09-21
@VoidVolker

pm2.keymetrics.io/docs/usage/process-management/#m...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question