INNER CODE UNIT · JavaScript
heapTotalMB
furey/mongodb-lens · mongodb-lens.js:198
const heapTotalMB = Math.round(memoryUsage.heapTotal / 1024 / 1024)
if (heapUsedMB > config.memory.warningThresholdMB) {
log(`High memory usage: ${heapUsedMB}MB used of ${heapTotalMB}MB heap`, true)
if (heapUsedMB > config.memory.criticalThresholdMB) {
log('Critical memory pressure. Clearing caches…', true)
clearMemoryCache()
if (config.memory.enableGC && global.gc) {
global.gc()
} else if (config.memory.enableGC) {
log('Garbage collection requested but not available. Run Node.js with --expose-gc flag.', true)
}
}
}
const isClientConnected = mongoClient && mongoClient.topology && mongoClient.topology.isConnected()
if (!isClientConnected && !isChangingConnection) {