File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
java_runtime/src/classes/java/lang Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -96,7 +96,19 @@ impl System {
9696 async fn gc ( jvm : & Jvm , _: & mut RuntimeContext ) -> Result < ( ) > {
9797 tracing:: debug!( "java.lang.System::gc()" ) ;
9898
99- jvm. collect_garbage ( ) ?;
99+ // TODO should be jvm arg
100+ let disable_explicit_gc_property: ClassInstanceRef < String > = jvm
101+ . invoke_static (
102+ "java/lang/System" ,
103+ "getProperty" ,
104+ "(Ljava/lang/String;)Ljava/lang/String;" ,
105+ ( JavaLangString :: from_rust_string ( jvm, "rustjava.disable_explicit_gc" ) . await ?, ) ,
106+ )
107+ . await ?;
108+
109+ if disable_explicit_gc_property. is_null ( ) || JavaLangString :: to_rust_string ( jvm, & disable_explicit_gc_property) . await ? != "true" {
110+ jvm. collect_garbage ( ) ?;
111+ }
100112
101113 Ok ( ( ) )
102114 }
@@ -165,7 +177,7 @@ impl System {
165177 }
166178
167179 pub async fn get_charset ( jvm : & Jvm ) -> Result < RustString > {
168- let charset: ClassInstanceRef < Self > = jvm
180+ let charset: ClassInstanceRef < String > = jvm
169181 . invoke_static (
170182 "java/lang/System" ,
171183 "getProperty" ,
You can’t perform that action at this time.
0 commit comments