codeql
codeql copied to clipboard
Javascript: Add environment variables to allow specifying memory sizes
Summary
This PR improves the situation described in https://github.com/github/codeql/issues/16780 where halving the available CODEQL_RAM
between the Typescript and JVM processes can lead to an out-of-memory condition.
Approach
This PR modifies the autobuild.(sh|cmd)
scripts to add two new environment variables, CODEQL_JAVASCRIPT_TS_MEMORY
and CODEQL_JAVASCRIPT_JVM_MAX_MEMORY
, which can be used to specify the amounts of memory that should be available to Typescript and the JVM, respectively.
The implementation is intended to work as follows:
-
CODEQL_JAVASCRIPT_TS_MEMORY
andCODEQL_JAVASCRIPT_JVM_MAX_MEMORY
are used to set the values forLGTM_TYPESCRIPT_RAM
andjvm_args
, respectively. - If
CODEQL_RAM
is set, then we will automatically calculate the values forCODEQL_JAVASCRIPT_TS_MEMORY
andCODEQL_JAVASCRIPT_JVM_MAX_MEMORY
if one or both are not set.- If either
CODEQL_JAVASCRIPT_TS_MEMORY
orCODEQL_JAVASCRIPT_JVM_MAX_MEMORY
is set, but the other isn't, then we calculate the missing value by subtracting the present value fromCODEQL_RAM
. - If both are missing, then we use half of the available
CODEQL_RAM
as before.
- If either
- If
CODEQL_RAM
is not set, then we use whatever values forCODEQL_JAVASCRIPT_TS_MEMORY
andCODEQL_JAVASCRIPT_JVM_MAX_MEMORY
that are available, if any.