Link RStudio instance to Process ID?

In Mac OS, with multiple instances of RStudio open (multiple projects open in different windows), is there a way to figure out which Activity Monitor Process ID is associated with which RStudio instance?

Sometimes I would like to figure out which of my open R projects is gobbling up memory or would like to selectively force quit one project, but it's not clear to me other than guesswork how to cross-reference Process IDs and open projects. Any tips?

Yep! Just run this in your R console:

> Sys.getpid()

That will return the Process ID of the rsession image, which you can look up in Activity Monitor.

Oh, that's great, I didn't know about that & it will be quite handy - thanks.

That command gets the ID for the R session; is there any way to get the Process ID of the RStudio project?

**Editing after the thread was closed: To figure out the RStudio process, ID the R process & open that process by double clicking it the Activity Monitor. In the top left corner it gives you a link to open the parent process, which if you're running R via RStudio is the RStudio process.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.