I was running my node (express) application on pm2 before and it was working fine. I decided to move it to IIS and setup everything. However it started working for static pages but in where I am connecting database and getting result I am facing memory issue and getthing the following error.
When I checked I found the code snippet which throw this error.
const getDB = () => {
return new Promise((resolve, reject) => {
pool.get((err, db) => {
if (err)
reject(err)
resolve(db)
})
});
}
I tried to increase the size of heap memory but not getting over come.
'use strict'
const v8 = require('v8')
const totalHeapSize = v8.getHeapStatisctics().total_available_size
let totalHeapSizeInGB = (totalHeapSize /1024 /1024/ 1024).toFixed(2)
console.log('Total heap size (bytes) ${totalHeapSize}, (GB ~${totalHeapSizeInGB}')