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
Memory leak in ktlint when used in gradle plugins #1216
Closed
jeremymailen opened this issue
Aug 16, 2021
· 5 comments
· Fixed by #1407 or ankidroid/Anki-Android#10608
Closed
Memory leak in ktlint when used in gradle plugins #1216
jeremymailen opened this issue
Aug 16, 2021
· 5 comments
· Fixed by #1407 or ankidroid/Anki-Android#10608
Comments
Has this been fixed in 0.43.0? |
No |
Possible fix that should be applied in KtLint project: JetBrains/kotlin#4650 |
I believe this issue is fixed in 0.43.0. At least it no longer reproduces in kotlinter-gradle 3.7.0. Curious of anyone can repro it in a different plugin? |
It's still not fix with 0.43.2 for me. |
7 tasks
paul-dingemans
added a commit
to paul-dingemans/ktlint
that referenced
this issue
Mar 13, 2022
5 tasks
paul-dingemans
added a commit
that referenced
this issue
Mar 13, 2022
* Explicitly dispose to (possibly) prevent a memory leak Possibly closes #1216
Merged
7 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It appears a memory leak was introduced between ktlint 0.40.0 and 0.41.0. Still present in 0.42.1.
This is based on very similar memory leak bugs filed for two different ktlint gradle plugins:
jeremymailen/kotlinter-gradle#204
JLLeitschuh/ktlint-gradle#507
Memory is leaked on both lint and format. The amount of memory leaked appears proportional to the number or size of files processed.
Looking through the commits, I can't pinpoint the issue yet, but I did notice there were changes to
KotlinPsiFileFactory
and its management. It may or may not be the source of the leak.The issue does not appear to be sensitive to the version of gradle or kotlin.
Expected Behavior
Calls to
Ktlint.lint()
andformat()
should not leak memory.Observed Behavior
When called from within gradle plugins which will make these calls multiple times and stay resident in the gradle daemon, memory is leaked over time and eventually the gradle daemon dies of memory exhaustion.
Steps to Reproduce
See linked issues above.
Your Environment
The text was updated successfully, but these errors were encountered: