codeql
codeql copied to clipboard
Javascript: Add environment variables to allow specifying memory sizes
trafficstars
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_MEMORYandCODEQL_JAVASCRIPT_JVM_MAX_MEMORYare used to set the values forLGTM_TYPESCRIPT_RAMandjvm_args, respectively.- If
CODEQL_RAMis set, then we will automatically calculate the values forCODEQL_JAVASCRIPT_TS_MEMORYandCODEQL_JAVASCRIPT_JVM_MAX_MEMORYif one or both are not set.- If either
CODEQL_JAVASCRIPT_TS_MEMORYorCODEQL_JAVASCRIPT_JVM_MAX_MEMORYis 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_RAMas before.
- If either
- If
CODEQL_RAMis not set, then we use whatever values forCODEQL_JAVASCRIPT_TS_MEMORYandCODEQL_JAVASCRIPT_JVM_MAX_MEMORYthat are available, if any.