Skip to content

Resource management for macro/plugin classloaders, classpath JARs#7366

Merged
lrytz merged 9 commits intoscala:2.13.xfrom
retronym:topic/macro-classloader
Nov 8, 2018
Merged

Resource management for macro/plugin classloaders, classpath JARs#7366
lrytz merged 9 commits intoscala:2.13.xfrom
retronym:topic/macro-classloader

Conversation

@retronym
Copy link
Member

Global now has a close() method, which closes any classloaders
and open JARs created for compiler plugins, macros, and the
classpath.

When these aren't owned by Global (because caching is turned on),
this reference counts are decremented on Global.close.

When the reference count for a resource reaches zero, it is queued
for close after a short (and configurable) delay.

Also introduces a setting to provide a restricted classpath for
the macro classloader, which can improve the hit ratio when
-Ycache-macro-classloader.

An extension point analagous to `findMacroClassLoader`
This lets customized Global's deliver this file, and offloads
the scanning logic.
Close Global-scoped JARs and ClassLoaders.

Entries of FileBasedCache that have a lifetime that exceeds any
single Global instance are reference counted. When the count
hits zero, it is closed if no references appear after a delay.
@scala-jenkins scala-jenkins added this to the 2.13.0-RC1 milestone Oct 23, 2018
@retronym retronym added the WIP label Oct 23, 2018
Co-Authored-By: retronym <jzaugg@gmail.com>
@retronym retronym changed the title Resource management macro/plugin classloaders, classpath JARs Resource management for macro/plugin classloaders, classpath JARs Oct 23, 2018
@jvican
Copy link
Member

jvican commented Oct 25, 2018

I'm reviewing this tomorrow, sorry for the delay!

Copy link
Member

@jvican jvican left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@SethTisue
Copy link
Member

@retronym is this still WIP?

@retronym retronym removed the WIP label Nov 8, 2018
@retronym retronym requested a review from lrytz November 8, 2018 06:27
@retronym
Copy link
Member Author

retronym commented Nov 8, 2018

@lrytz Could you please take a look at this one?

@retronym retronym force-pushed the topic/macro-classloader branch from 0268bc4 to a9105fb Compare November 8, 2018 06:29
@lrytz lrytz merged commit 0c33545 into scala:2.13.x Nov 8, 2018
retronym added a commit to retronym/scala that referenced this pull request Jan 15, 2019
retronym added a commit to retronym/scala that referenced this pull request Jan 15, 2019
retronym added a commit to retronym/scala that referenced this pull request Jan 22, 2019
retronym added a commit to retronym/scala that referenced this pull request Feb 4, 2019
retronym added a commit to retronym/scala that referenced this pull request Feb 4, 2019
retronym added a commit to retronym/scala that referenced this pull request Feb 4, 2019
retronym added a commit to retronym/scala that referenced this pull request Feb 20, 2019
retronym added a commit to retronym/zinc that referenced this pull request Feb 26, 2019
This will close file handles to JARs within recent versions
of Scalac.

References scala/scala#7366
retronym added a commit to retronym/zinc that referenced this pull request Feb 26, 2019
This will close file handles to JARs within recent versions
of Scalac.

References scala/scala#7366
eed3si9n pushed a commit to eed3si9n/scala that referenced this pull request May 14, 2019
This will close file handles to JARs within recent versions
of Scalac.

References scala#7366
lrytz pushed a commit to lrytz/scala that referenced this pull request Nov 5, 2019
This will close file handles to JARs within recent versions
of Scalac.

References scala#7366

Rewritten from sbt/zinc@1f91729
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants