I have noticed that I often will have multiple R processes still running, and occupying a significant amount of RAM, even if I closed all applications that I use for R.
For the most part I use VS Code with the Jupyter extension, and based on the commands running (below) the lingering R sessions are seemingly remnants of the last Jupyter session in VS Code. (I open RStudio or JupyterLab from time to time, as I recently switched and I need it for comparison.)
To see if this issue was reproducible elsewhere, I opened JupyterLab, and the same issue persists here. Multiple R sessions are initiated (presumably due to several tabs open in the IDE. However, they are not terminated when closing.) It could seem the problem is Jupyter related, however, I have also seen other programs, such as Evolution, have the same issue.
I am wondering if this is operating system related (running Ubuntu 20.04 LTS) or software specific. In either case, I am looking for a solution that will kill all related processes when the application is closed.
As the picture shows, they occupy roughly 4 GB of the available memory, so it's not exactly peanuts. Checking the process properties, I could see that the following commands are running (some are duplicated):
- Process ID 203329 and 203327
/usr/lib/R/bin/exec/R --slave -e IRkernel::main() --args/tmp/tmp-1362468kUQHDQHd8fJ.json
- Process ID 14177 and 18379
/usr/lib/R/bin/exec/R --slient --slave --no-save --no-restore -f /home/user/.vscode/extensions/ikuyadeu.r-2.3.5/R/help/helpServer.R
- Process ID 9667 and 13358
/usr/lib/R/bin/exec/R --slave -e IRkernel::main() --args/tmp/tmp-9630S3jb7T9Q3FPt.json