question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Memory leak in ktlintFormat task

See original GitHub issue

Probably related with #447

I’m running git rebase -i develop --exec "./gradlew ktlintFormat" on a branch with 40 commits and I’m getting this error on my local machine (macOS):

> A failure occurred while executing org.jlleitschuh.gradle.ktlint.worker.KtLintWorkAction
   > Java heap space

It seems like a leak to me. The first 5 coomits ok, then the next failed. I reran the task manually on that commit and it worked. But then the 8th commit failed. and the pattern continued until the commit 15th. I can’t run the task any more. It fails every single time with the error I pasted above. As soon as I killed the daemon ./gradlew --stop it worked.

I’m using v10.1.0

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:8
  • Comments:18 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
Tapchicomacommented, Jul 2, 2021

Yes, for some unknown reason (Kotlin update) Ktlint 0.41.0 uses more memory then before…

2reactions
gabrielle-cozartcommented, Jan 6, 2022

Okay, so I’ve been running with version 0.43.0 since this was last updated, and I just now started seeing this issue again.

> Task :app:runKtlintFormatOverMainSourceSet FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:runKtlintFormatOverMainSourceSet'.
> A failure occurred while executing org.jlleitschuh.gradle.ktlint.worker.KtLintWorkAction
   > Java heap space
Read more comments on GitHub >

github_iconTop Results From Across the Web

Kotlin: Is this a good way to avoid memory leaks? [closed]
Well, this is my possible solution and I would like to know Android gurus from SO opinion about it. Maybe I'm leaking memory...
Read more >
Android Kotlin/Java Code Guidelines
ktlintCheck - checks all SourceSets and project Kotlin script files,; ktlintFormat - tries to format according to the code style all SourceSets Kotlin...
Read more >
a resolved google play services library dependency depends on ...
At that moment, the View reference might be destroyed or might be an old activity that is no longer visible, generating a memory...
Read more >
Ktlint: An Anti-Bikeshedding Kotlin Linter with Built-in Formatter
Gradle plugin that automatically creates check and format tasks for project ... dependsOn ktlint task ktlintFormat(type: JavaExec, group: "formatting") ...
Read more >
How to detect and fix Memory Leaks on Android ... - YouTube
Check out my 15+ hours Video Course "Kotlin Coroutines and Flow for Android Development" Get it here: ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found