Call the soon-to-exist Global#close when done compiling#3261
Closed
Call the soon-to-exist Global#close when done compiling#3261
Conversation
Scala 2.13.3 is likely to have a new method, `Global.close`. This will let the compiler release resources, notably file handles to JARs on the classpath. This commit calls changes the compiler interfaces to call this method, falling back to a no-op extension method for backwards compatibility. Furthermore, it changes the API to the global cache to let the caller hand back the compiler instance. By default, this compiler cache is a no-op (`GlobalCache.fresh`), and this is where I've added the `close` call. The other code path does not close the Global. AFAIK, caching global instances (enabled with `sbt -Dsbt.resident.limit=<N>`) a unfinished experiment and and not use in the wild. For instance, I don't see how the current implementation ensures single threaded access to the cached global instances, I would have expected a check-out/check-in protocol to deal with that. In any case, that code path is untouched under this patch.
Member
Author
|
Marking as See scala/bug#10295 / https://github.com/retronym/scala/tree/ticket/10295 |
Member
This has been removed in Zinc 1: sbt/zinc#340 |
1 task
Member
|
I think we should look to improve the performance of sbt 1 rather than sbt 0.13. As such, I think we should close this. |
Member
Author
I think the removal was incomplete. SBT still has logic around |
Member
Yes, though IIRC it's disabled by default. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Scala 2.13.3 is likely to have a new method,
Global.close.This will let the compiler release resources, notably file
handles to JARs on the classpath.
This commit calls changes the compiler interfaces to call this
method, falling back to a no-op extension method for backwards
compatibility.
Furthermore, it changes the API to the global cache to let
the caller hand back the compiler instance. By default, this
compiler cache is a no-op (
GlobalCache.fresh), and this iswhere I've added the
closecall.The other code path does not close the Global. AFAIK, caching
global instances (enabled with
sbt -Dsbt.resident.limit=<N>)a unfinished experiment and and not use in the wild. For instance,
I don't see how the current implementation ensures single threaded
access to the cached global instances, I would have expected a
check-out/check-in protocol to deal with that.
In any case, that code path is untouched under this patch.