File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -163,6 +163,7 @@ function extractFile(filename: string): string {
163163function prepareNextFile ( ) {
164164 if ( state . pendingResponse != null ) return ;
165165 if ( state . pendingFileIndex < state . pendingFiles . length ) {
166+ checkMemoryUsage ( ) ;
166167 let nextFilename = state . pendingFiles [ state . pendingFileIndex ] ;
167168 state . pendingResponse = extractFile ( nextFilename ) ;
168169 }
@@ -538,6 +539,8 @@ let isAboveReloadThreshold = false;
538539
539540/**
540541 * If memory usage has moved above a the threshold, reboot the TypeScript compiler instance.
542+ *
543+ * Make sure to call this only when stdout has been flushed.
541544 */
542545function checkMemoryUsage ( ) {
543546 let bytesUsed = process . memoryUsage ( ) . heapUsed ;
@@ -560,7 +563,6 @@ function runReadLineInterface() {
560563 switch ( req . command ) {
561564 case "parse" :
562565 handleParseCommand ( req ) ;
563- checkMemoryUsage ( ) ;
564566 break ;
565567 case "open-project" :
566568 handleOpenProjectCommand ( req ) ;
You can’t perform that action at this time.
0 commit comments