Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[jssrc2cpg] Pass JVM max memory setting to astgen #4990

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,17 @@ object AstGenRunner {

private val LineLengthThreshold: Int = 10000

private val NODE_OPTIONS: Map[String, String] = Map("NODE_OPTIONS" -> "--max-old-space-size=8192")
private def getMaxHeapSizeInMB: Long = {
val maxHeapSizeInBytes = Runtime.getRuntime.maxMemory()
val maxHeapSizeInMB = maxHeapSizeInBytes / (1024 * 1024)
maxHeapSizeInMB // nodejs expects MB
}

private def nodejsSpaceSize: Int = {
Math.max(getMaxHeapSizeInMB.toInt, 8192) // as default we set 8G minimum
}

private val NODE_OPTIONS: Map[String, String] = Map("NODE_OPTIONS" -> s"--max-old-space-size=$nodejsSpaceSize")

private val TypeDefinitionFileExtensions = List(".t.ts", ".d.ts")

Expand Down
Loading