Noobie Noobie - 19 days ago 5x
R Question

see RAM usage in R-studio before crash?

I am switching from Python to R for some projects, and I have a hard time understanding the RAM management in R - R-Studio.

I have the following two simple questions

  • can we see how much RAM is being used by R at the moment? Just like in Spyder one can see that, say, 20% of the current RAM is full. That will allow me to understand if I can move one with my code, or if a memory crash is close.

  • do I need to set-up a maximum amount of RAM that R can use or everything is automatic like in Python (where Spyder eats RAM as it needs it)

Many thanks!


Check gc() to check how much memory is being used.

And I think R uses all the memory available. However, you can also set the memory limit by memory.limit(size=).

Moreover, I would recommend using Microsoft R Open It boosts the calculations speed as it introduces some parallel processing. Check out other Microsoft Client R and Server R as well.