File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,6 @@ const assert = require('assert');
2727const vm = require ( 'vm' ) ;
2828
2929const start = Date . now ( ) ;
30- let maxMem = 0 ;
3130
3231const interval = setInterval ( function ( ) {
3332 try {
@@ -36,22 +35,20 @@ const interval = setInterval(function() {
3635 }
3736
3837 const rss = process . memoryUsage ( ) . rss ;
39- maxMem = Math . max ( rss , maxMem ) ;
38+ assert . ok ( rss < 64 * 1024 * 1024 ,
39+ `memory usage: ${ Math . round ( rss / ( 1024 * 1024 ) ) } Mb` ) ;
4040
41+ // Stop after 5 seconds.
4142 if ( Date . now ( ) - start > 5 * 1000 ) {
42- // wait 10 seconds.
4343 clearInterval ( interval ) ;
4444
4545 testContextLeak ( ) ;
4646 }
4747} , 1 ) ;
4848
4949function testContextLeak ( ) {
50+ // TODO: This needs a comment explaining what it's doing. Will it crash the
51+ // test if there is a memory leak? Or what?
5052 for ( let i = 0 ; i < 1000 ; i ++ )
5153 vm . createContext ( { } ) ;
5254}
53-
54- process . on ( 'exit' , function ( ) {
55- console . error ( `max mem: ${ Math . round ( maxMem / ( 1024 * 1024 ) ) } mb` ) ;
56- assert . ok ( maxMem < 64 * 1024 * 1024 ) ;
57- } ) ;
You can’t perform that action at this time.
0 commit comments