Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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 @@ -79,9 +79,11 @@ internal class BitcodeCompiler(
/**
* Compile [bitcodeFile] to [objectFile].
*/
fun makeObjectFile(bitcodeFile: File, objectFile: File) =
when (val configurables = platform.configurables) {
is ClangFlags -> clang(configurables, bitcodeFile, objectFile)
else -> error("Unsupported configurables kind: ${configurables::class.simpleName}!")
}
fun makeObjectFile(bitcodeFile: File, objectFile: File) {
System.gc() // Release memory before spawning clang++
when (val configurables = platform.configurables) {
is ClangFlags -> clang(configurables, bitcodeFile, objectFile)
else -> error("Unsupported configurables kind: ${configurables::class.simpleName}!")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ internal class Linker(
}

internal fun runLinkerCommands(context: NativeBackendPhaseContext, commands: List<Command>, cachingInvolved: Boolean) = try {
System.gc() // Release memory before spawning linker
commands.forEach {
it.logWith(context::log)
it.execute()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ fun produceCAdapterBitcode(clang: ClangArgs, cppFile: File, bitcodeFile: File) {
"-emit-llvm", "-c",
"-o", bitcodeFile.absoluteFile.normalize().path
)
System.gc() // Release memory before spawning clang++
Command(clangCommand).execute()
}