在nodejs中运行mochatesting用例时出现内存不足exception

对于unit testing,我正在使用mocha ,最近在运行testing用例out of memory exception我正在观察out of memory exception

 --- Last few GCs ---> 548213 ms: Scavenge 1365.3 (1457.7) -> 1365.3 (1457.7) MB, 1.2 / 0 ms (+ 1.5 ms in 2 steps since last GC) [allocation failure] [incremental marking delaying mark-sweep]. 549442 ms: Mark-sweep 1365.3 (1457.7) -> 1364.3 (1457.7) MB, 1228.6 / 0 ms (+ 2.8 ms in 4 steps since start of marking, biggest step 1.2 ms) [last resort gc]. 550603 ms: Mark-sweep 1364.3 (1457.7) -> 1309.1 (1457.7) MB, 1161.4 / 0 ms [last resort gc]. <--- JS stacktrace ---> ==== JS stack trace ========================================= Security context: 0x30d0b01e3ac1 <JS Object> 2: _compile [module.js:~380] [pc=0x333b9a368f36] (this=0x29e81578a591 <a Module with map 0x364941617b89>,content=0x4ec389e5fd1 <Very long string[26212]>,filename=0x31a758c32891 <String[92]: /Users/pulkit.sharva/apps/code/node_modules/bluebird/js/release/debuggability.js>) 3: .js [module.js:~420] [pc=0x333b9869e18b] (this=0x1b3ffe7cfcc9 <an Object with map 0x364941655fb9>,mod... FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory sh: line 1: 38263 Abort trap: 6 NODE_ENV=test istanbul cover _mocha -- --timeout 3000 -R spec --recursive test 

有反正/有工具,我可以通过它来确定哪个testing用例造成这种情况,因为我可以看到我的堆大小正在迅速增加

 code pulkit.sharva$ node --expose-gc > process.memoryUsage(); { rss: 21069824, heapTotal: 9587488, heapUsed: 4520544 } > process.memoryUsage(); { rss: 22892544, heapTotal: 9587488, heapUsed: 5407376 } > process.memoryUsage(); { rss: 23261184, heapTotal: 10619424, heapUsed: 5785296 } > process.memoryUsage(); { rss: 23560192, heapTotal: 10619424, heapUsed: 6075440 } > process.memoryUsage(); { rss: 23642112, heapTotal: 10619424, heapUsed: 6158888 } > process.memoryUsage(); { rss: 23715840, heapTotal: 10619424, heapUsed: 6231968 }