Hi Does rJava offer a way to instruct the JVM to perform a garbage collection? Regards Ben
rJava offers a mechanism to call arbitrary methods in Java. Wouldn't you use that mechanism to call whatever you would call if you were programming in Java (e.g. System.gc)? -- Sent from my phone. Please excuse my brevity. On February 5, 2018 7:34:17 PM PST, Benjamin Tyner <btyner at gmail.com> wrote:>Hi > >Does rJava offer a way to instruct the JVM to perform a garbage >collection? > >Regards > >Ben > >______________________________________________ >R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide >http://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code.
On 6 February 2018 at 04:34, Benjamin Tyner <btyner at gmail.com> wrote:> Hi > > Does rJava offer a way to instruct the JVM to perform a garbage collection?Do you really, really need to run the garbage collector? Consider reading: https://stackoverflow.com/questions/5086800/java-garbage-collection Regards Martin
Thanks Jeff; indeed it works: ?? .jcall("java/lang/System", method = "gc") On 02/05/2018 11:53 PM, Jeff Newmiller wrote:> rJava offers a mechanism to call arbitrary methods in Java. Wouldn't you use that mechanism to call whatever you would call if you were programming in Java (e.g. System.gc)?
Hi Martin, Thanks for providing the reference. In this particular case, it helped me to discover that 13 JVM threads were garbage collecting in parallel, occasionally resulting in a race condition. Setting ??? options(java.parameters = "-XS:ParallelGCThreads=1") appears to resolve the issue. Regards Ben> ------------------------------------------------------------------------ > On 6 February 2018 at 04:34, Benjamin Tyner <btyner at gmail.com <https://stat.ethz.ch/mailman/listinfo/r-help>> wrote: > >/Hi />//>/Does rJava offer a way to instruct the JVM to perform a garbage > collection? / > Do you really, really need to run the garbage collector? > > Consider reading: > https://stackoverflow.com/questions/5086800/java-garbage-collection > > Regards > Martin >