Hi Kevin, thanks for your response.
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:
'library(data.table)
dt<-data.table(a=rep(1:5),b=runif(10000000))
dt<-data.table(setid=dt[a %in% c(1,5),a][rep(seq_len(.N),each=2)])
dt.final<-rbindlist(list(dt,dt))'
Let me know if you need me to run something on my machine and give some output to help.