Skip to content
New issue

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

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

Already on GitHub? # to your account

evict cached Scalafix instances under memory pressure #439

Merged
merged 1 commit into from
Oct 4, 2024

Conversation

bjaglin
Copy link
Collaborator

@bjaglin bjaglin commented Oct 4, 2024

Scalafix instances can be memory-consuming (PrintStream's static 8k BufferedWriter allocations are wasteful and hard to remove for example), so this allow eviction in case of memory pressure.

To compensate for the added complexity, the implementation was simplified.

  • Values are now always updated (even if they haven't changed). This probably does not change much performance-wise, as we are trading throwing an exception (costly) against a SoftReference instanciation and the update in the low-cardinality ConcurrentHashMap.
  • SAM conversion is used now that sbt 0.13 / Scala 2.11 are no longer supported.

Scalafix instances can be memory-consuming (PrintStream's static 8k
BufferedWriter allocations are wasteful and hard to remove for example), so
this allow eviction in case of memory pressure.

To compensate for the added complexity, the implementation was simplified.
* Values are now always updated (even if they haven't changed). This
  probably does not change much performance-wise, as we are trading throwing
  an exception (costly) against a SoftReference instanciation and the update
  in the low-cardinality ConcurrentHashMap.
* SAM conversion is used now that sbt 0.13 / Scala 2.11 are no longer
  supported.
@bjaglin bjaglin marked this pull request as ready for review October 4, 2024 07:49
@bjaglin bjaglin changed the title allow eviction of cached Scalafix instances allow eviction of cached Scalafix instances under memory pressure Oct 4, 2024
@bjaglin bjaglin changed the title allow eviction of cached Scalafix instances under memory pressure evict cached Scalafix instances under memory pressure Oct 4, 2024
@bjaglin bjaglin merged commit d2c99b3 into scalacenter:main Oct 4, 2024
6 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant