3636import com .semmle .js .parser .ParsedProject ;
3737import com .semmle .js .parser .JSParser .Result ;
3838import com .semmle .util .data .StringUtil ;
39- import com .semmle .util .data .UnitParser ;
4039import com .semmle .util .exception .CatastrophicError ;
4140import com .semmle .util .exception .Exceptions ;
4241import com .semmle .util .exception .InterruptedError ;
@@ -96,24 +95,6 @@ public class TypeScriptParser {
9695 */
9796 public static final String TYPESCRIPT_RETRIES_VAR = "SEMMLE_TYPESCRIPT_RETRIES" ;
9897
99- /**
100- * An environment variable (without the <code>SEMMLE_</code> or <code>LGTM_</code> prefix), that can be
101- * set to indicate the maximum heap space usable by the Node.js process, in addition to its
102- * "reserve memory".
103- *
104- * <p>Defaults to 2000 MB (for a total heap space of 2400 MB by default).
105- */
106- public static final String TYPESCRIPT_RAM_SUFFIX = "TYPESCRIPT_RAM" ;
107-
108- /**
109- * An environment variable (without the <code>SEMMLE_</code> or <code>LGTM_</code> prefix), that can be
110- * set to indicate the additional heap space added to <code>TYPESCRIPT_RAM</code> when setting the
111- * Node.js heap limit.
112- *
113- * <p>Defaults to 400 MB (for a total heap space of 2400 MB by default).
114- */
115- public static final String TYPESCRIPT_RAM_RESERVE_SUFFIX = "TYPESCRIPT_RAM_RESERVE" ;
116-
11798 /**
11899 * An environment variable with additional VM arguments to pass to the Node process.
119100 *
@@ -154,17 +135,9 @@ public class TypeScriptParser {
154135 */
155136 private List <String > nodeJsRuntimeExtraArgs = Collections .emptyList ();
156137
157- /** If non-zero, we use this instead of relying on the corresponding environment variable. */
158- private int typescriptRam = 0 ;
159-
160138 /** Metadata requested immediately after starting the TypeScript parser. */
161139 private TypeScriptParserMetadata metadata ;
162140
163- /** Sets the amount of RAM to allocate to the TypeScript compiler.s */
164- public void setTypescriptRam (int megabytes ) {
165- this .typescriptRam = megabytes ;
166- }
167-
168141 /**
169142 * Verifies that Node.js and TypeScript are installed and throws an exception otherwise.
170143 *
@@ -274,14 +247,6 @@ private List<String> getNodeJsRuntimeInvocation(String... args) {
274247 private void setupParserWrapper () {
275248 verifyNodeInstallation ();
276249
277- int mainMemoryMb =
278- typescriptRam != 0
279- ? typescriptRam
280- : EnvironmentVariables .getMegabyteCountFromPrefixedEnv (TYPESCRIPT_RAM_SUFFIX , 2000 );
281- int reserveMemoryMb = EnvironmentVariables .getMegabyteCountFromPrefixedEnv (TYPESCRIPT_RAM_RESERVE_SUFFIX , 400 );
282-
283- System .out .println ("Memory for TypeScript process: " + mainMemoryMb + " MB, and " + reserveMemoryMb + " MB reserve" );
284-
285250 File parserWrapper = getParserWrapper ();
286251
287252 String debugFlagString = Env .systemEnv ().getNonEmpty (TYPESCRIPT_NODE_FLAGS );
@@ -297,7 +262,6 @@ private void setupParserWrapper() {
297262 }
298263
299264 List <String > cmd = getNodeJsRuntimeInvocation ();
300- cmd .add ("--max_old_space_size=" + (mainMemoryMb + reserveMemoryMb ));
301265 cmd .addAll (debugFlags );
302266 cmd .add (parserWrapper .getAbsolutePath ());
303267
0 commit comments