rsession CPU usage when idle

2019-02-17 16:16发布

问题:

I have recently noticed an issue with my R / RStudio installation. When I have RStudio opened, the CPU usage in activity monitor shows the rsession and kernel_task processes hovering around 30% usage even when R is idle and not running anything. I know this is a very vague description of the issue, I'm hoping someone here can give me pointers how to debug this issue or post more relevant information.

Thank you.

> sessionInfo()
R version 2.15.2 (2012-10-26)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
[1] tools_2.15.2

回答1:

If you are working in a specific Rstudio project, and this project has lots of files (hundreds or thousands) Rstudio may be trying to index the files -

I fixed this by:

  1. From the Rstudio IDE while in a project,
  2. Go to Tools -> Project Options
  3. Now click on code editing
  4. deselect Index R Source Files
  5. close everything and restart Rstudio

Editing

Index R source files — Determines whether R source files within the project directory are indexed for code navigation (i.e. go to file/function, go to function definition). Normally this should remain enabled, however if you have a project directory with thousands of files and are concerned about the overhead of monitoring and indexing them you can disable indexing here.
Insert spaces for tab — Determine whether the tab key inserts multiple spaces rather than a tab character (soft tabs). Configure the number of spaces per soft-tab.
Text encoding — Specify the default text encoding for source files. Note that source files which don't match the default encoding can still be opened correctly using the File : Reopen with Encoding menu command. Source



标签: macos r rstudio