Skip to content

Commit 53c26bd

Browse files
author
Forbes Lindesay
committed
Don't use heapTotal either
heapUsed is what really tells us if we have a leak. heapTotal is more indicative of how often gc runs.
1 parent 0b46854 commit 53c26bd

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

test/memory-leak.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,14 @@ function next() {
1919
global.gc()
2020
sampleA = process.memoryUsage()
2121
}
22-
if (i > 100000 * 5) {
22+
if (i > 100000 * 10) {
2323
if (typeof global.gc === 'function') {
2424
global.gc()
2525
sampleB = process.memoryUsage()
2626
console.log('Memory usage at start:');
2727
console.dir(sampleA)
2828
console.log('Memory usage at end:');
2929
console.dir(sampleB)
30-
assert(sampleA.heapTotal * 1.2 > sampleB.heapTotal, 'heapTotal should not grow by more than 20%')
3130
assert(sampleA.heapUsed * 1.2 > sampleB.heapUsed, 'heapUsed should not grow by more than 20%')
3231
}
3332
} else {

0 commit comments

Comments
 (0)