@@ -73,6 +73,31 @@ for (const value of invalidLimits) {
7373 JSON . parse ( profile ) ;
7474}
7575
76+ {
77+ const handle = v8 . startHeapProfile ( { sampleInterval : 1 , stackDepth : 8 } ) ;
78+ const retained = [ ] ;
79+ for ( let i = 0 ; i < 4096 ; i ++ ) {
80+ retained . push ( { i, payload : new Array ( 16 ) . fill ( i ) } ) ;
81+ }
82+ const parsed = JSON . parse ( handle . stop ( ) ) ;
83+
84+ assert . strictEqual ( typeof parsed . head . selfSize , 'number' ) ;
85+ assert . strictEqual ( typeof parsed . head . selfCount , 'number' ) ;
86+ assert . strictEqual ( typeof parsed . head . id , 'number' ) ;
87+ assert . strictEqual ( typeof parsed . head . callFrame , 'object' ) ;
88+
89+ assert ( parsed . samples . length > 0 ) ;
90+ for ( const sample of parsed . samples ) {
91+ assert . strictEqual ( typeof sample . size , 'number' ) ;
92+ assert . strictEqual ( typeof sample . objectSize , 'number' ) ;
93+ assert . strictEqual ( typeof sample . objectCount , 'number' ) ;
94+ assert . strictEqual ( typeof sample . nodeId , 'number' ) ;
95+ assert . strictEqual ( typeof sample . ordinal , 'number' ) ;
96+ assert . strictEqual ( typeof sample . isLive , 'boolean' ) ;
97+ assert . strictEqual ( sample . size , sample . objectSize * sample . objectCount ) ;
98+ }
99+ }
100+
76101// Second stop returns undefined.
77102{
78103 const handle = v8 . startHeapProfile ( ) ;
0 commit comments