Why does R Studio freeze when I enter a non-existing variable?

Sometimes when I misspell a variable/function (and in particular when the RAM usage is >80% and some of the data is on SWAP) the R freezes and uses 1 core of the CPU. After (more than) a few minutes I get an error message. During this time I am unable to terminate R.

Why is this happening and is it possible to fix it?

I am on

Linux Mint 18.1 64bit, 
Cinnamon V3.2.7,
Linux Kernel 4.4.0-138-generic,
RStudio Version 1.1.456,
R version 3.5.1 (2018-07-02)