I have a script that does a range of things: pull data from SQL server, manipulations using data.table & custom packages, parallel processing using Rcpp, etc. When R is idle & I hold some large data.tables in memory, i type something into the script just to activate the save button, undo the addition, save the script, and suddenly the RAM & CPU usage spikes and eventually settles to something nearly 50% higher. I just also noticed that in fact the CPU & RAM usage spikes as soon as I type into the script! When I do gc(), the RAM returns to previous level. Please let me know what information I should provide to identify the problem. Any help/advice would be greatly appreciated!
I should also say I ran into this problem only recently. I updated R to 3.5, then I reverted back to 3.4 as I couldn't get Rtools to work. Hope this helps.
Can you by any chance provide a reproducible example?
Just to confirm, is it the rsession process itself that's consuming RAM + CPU, or is it a sub-process launched by the R session (or even, the RStudio front-end process)? Does the task manager report this in any granularity? Does the R session remain responsive when this CPU usage spike happens, or is it frozen for a short amount of time?
Just to confirm, is it the rsession process itself that's consuming RAM + CPU, or is it a sub-process launched by the R session (or even, the RStudio front-end process)? -- I see "R Studio R session" under "Background Processes" in Task Manager consume the RAM and CPU.
Does the task manager report this in any granularity? -- I see R Studio under "Apps" and "R Studio R session" under background processes only. I don't see further detail relevant to R. Let me know if you need me to look somewhere specifically however.
Does the R session remain responsive when this CPU usage spike happens, or is it frozen for a short amount of time? -- I run a command from the console when the RAM & CPU spike and it looks like it gets queued to execute. The application however is not frozen per say, I am still able to type and move around only there is delay in execution. So, for example, gc() from console waits until the spike is complete and then runs, same delay happens if I save script, it gets done when the spike is complete.
Here is a simple example but it does not cause jumps in RAM & CPU. In the main script however, doing stuff like this starts causes the jumps:
I have 32gb RAM & Intel Xeon E5-2690 v3. It is setup as a virtual computer and resources are shared with other people however everyone else is disconnected.