I have raised an issue in data.table github page:
Let me copy the question to here:
" Hi I run into this problem very often.
Basically after I fread a csv file (about 300mb only), do some basic data manipulations (like looking for some data, changing values, creating new columns etc...) and let R studio idle for say 2 minutes, then executing a new command the program would take about 30 seconds to show result (e.g. Viewing the data.table).
Meanwhile when I look at task manager, the CPU usage is constantly working at 30% and could see the ram usage fluctuating. It appears like the computer is sorting out the memory....
The problem is similar to this one:
R studio RAM & CPU usage spikes every time I save script
So I follow in the link to try finding which code causes the lag, i ran
It appears that dotryCatch, tryCatch occupied the time most ~44seconds.
I have 32GB of ram and after some data manupulation, the ram usage is just 1Gb. "
As they suggested, the problem is solved by running RGui but not R-studio IDE. Hence I suspect it is the connection between R-studio and R-console.
Can someone have a look at it?