为什么Gradle构建的Kotlin源代码暂停约3秒“强制System.gc()”? [英] Why is Gradle build of Kotlin source code pausing for ~3 secs "forcing System.gc()"?

查看:277
本文介绍了为什么Gradle构建的Kotlin源代码暂停约3秒“强制System.gc()”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


[LIFECYCLE] $ b每个构建需要额外的3-4秒,在日志输出打印以下内容后立即暂停。 $ b [org.jetbrains.kotlin.gradle.plugin.KotlinGradleBuildServices]强制
System.gc()


为什么是它迫使这个?我如何避免这种情况,并加快我的构建?

解决方案

我研究过这个,这是Gradle的调试级别日志记录已启用(例如 gradle --debug assemble


$ b 运行Gradle而不启用调试日志记录(例如, gradle --info assemble 这不应该再发生。



参考文献: libraries / tools / kotlin-gradle-plugin / src / main / kotlin / org / jetbrains / kotlin / gradle / plugin / KotlinGradleBuildServices.kt


Every build takes an extra 3-4 seconds, pausing immediately after the log output prints the following.

[LIFECYCLE] [org.jetbrains.kotlin.gradle.plugin.KotlinGradleBuildServices] Forcing System.gc()

Why is it "forcing" this? How do I avoid this and speed up my build?

解决方案

I've looked into this, and this is a consequence of having Gradle's debug-level logging enabled (eg. gradle --debug assemble).

Run Gradle without debug logging enabled (eg. gradle --info assemble) and this should not occur anymore.

References: libraries/tools/kotlin-gradle-plugin/src/main/kotlin/org/jetbrains/kotlin/gradle/plugin/KotlinGradleBuildServices.kt

这篇关于为什么Gradle构建的Kotlin源代码暂停约3秒“强制System.gc()”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆