JavaScript heap out of memory while updating the mongodb JavaScript heap out of memory while updating the mongodb mongoose mongoose

JavaScript heap out of memory while updating the mongodb


You are getting this because your function call stack is not getting free since they are waiting for other calls to complete its execution.

Since all the call stacks blocked your stack memory and hence after some executions you are getting out of memory exception.

Check this link:https://eslint.org/docs/rules/no-await-in-loop

As you can see your await call blocked in memory for other await to finish and they are returning you the value in one go which is bad in your code.

It is actually you are making a sync call and each sync call waiting for other sync calls to finish and finally, your sync calls get pile up in stack memory and you are getting the exception.