Skip to content

Conversation

@Friendseeker
Copy link
Member

@Friendseeker Friendseeker commented Oct 7, 2024

Issue

runFinalization is marked for removal in newer JDK version. This causes CI runs targeting Java 21 to fail.

[info] 	published ivy to C:\Users\runneradmin\.ivy2\local\org.scala-sbt\main-settings_2.12\1.10.2-SNAPSHOT\ivys\ivy.xml
[error] D:\a\sbt\sbt\main\src\main\scala\sbt\internal\AbstractTaskProgress.scala:125:49: method getId in class Thread is deprecated
[error]     val threadId: Long = Thread.currentThread().getId
[error]                                                 ^
[error] D:\a\sbt\sbt\main\src\main\scala\sbt\internal\GCUtil.scala:41:16: method runFinalization in class System is deprecated
[error]         System.runFinalization()
[error]                ^
[error] two errors found
[error] (mainProj / Compile / compileIncremental) Compilation failed

Fix

Remove call to runFinalization.

Impact

runFinalization is added to fix garbage collection issue in JDK 6, 7. Quoting #1223

Java 8 replaces the PermGen with a "Meta" space, but it is still subject to leaks. However, it calls finalizers more promptly, which avoids this issue. Java 6 and Java 7 are both affected.

We no longer targets Java 6 & 7.

@Friendseeker Friendseeker changed the title [1.x] Remove deprecated runFinalization [1.x] Remove usage of deprecated runFinalization Oct 7, 2024
runFinalization is going to be removed
@Friendseeker Friendseeker changed the title [1.x] Remove usage of deprecated runFinalization [1.x] Remove deprecated runFinalization Oct 7, 2024
@Friendseeker Friendseeker requested a review from eed3si9n October 7, 2024 01:18
@Friendseeker Friendseeker changed the title [1.x] Remove deprecated runFinalization [1.x] Remove deprecated System.runFinalization Oct 7, 2024
@eed3si9n eed3si9n merged commit 09c13af into sbt:1.10.x Oct 7, 2024
10 checks passed
@Friendseeker Friendseeker deleted the remove-gc-workaround branch October 7, 2024 01:48
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.

2 participants