Skip to content

Commit 6f40f90

Browse files
committed
Collect garbage on explicit gc call
1 parent a390aff commit 6f40f90

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

java_runtime/src/classes/java/lang/system.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,12 @@ impl System {
9292
Ok(context.now() as _)
9393
}
9494

95-
async fn gc(_: &Jvm, _: &mut RuntimeContext) -> Result<i32> {
96-
tracing::warn!("stub java.lang.System::gc()");
95+
async fn gc(jvm: &Jvm, _: &mut RuntimeContext) -> Result<()> {
96+
tracing::debug!("java.lang.System::gc()");
9797

98-
Ok(0)
98+
jvm.collect_garbage()?;
99+
100+
Ok(())
99101
}
100102

101103
async fn arraycopy(

0 commit comments

Comments
 (0)