rJava garbage collect

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

rJava garbage collect

Benjamin Tyner
Hi

Does rJava offer a way to instruct the JVM to perform a garbage collection?

Regards

Ben

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: rJava garbage collect

Jeff Newmiller
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 <[hidden email]> wrote:

>Hi
>
>Does rJava offer a way to instruct the JVM to perform a garbage
>collection?
>
>Regards
>
>Ben
>
>______________________________________________
>[hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: rJava garbage collect

Martin Møller Skarbiniks Pedersen
In reply to this post by Benjamin Tyner
On 6 February 2018 at 04:34, Benjamin Tyner <[hidden email]> 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

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: rJava garbage collect

Benjamin Tyner
In reply to this post by Jeff Newmiller
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)?

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: rJava garbage collect

Benjamin Tyner
In reply to this post by Martin Møller Skarbiniks Pedersen
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
>

______________________________________________
[hidden email] 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.