I did not get very well what memory.size and memory.limit in R do? I think memory.limit is the total amount of MB of my RAM, but why I can increase it using memory.limit(size=....)?
Asked
Active
Viewed 3,525 times
1
-
I haven't read it, but you can put `?` in front of the function to read about it. e.g. `?memory.size` – stevec Feb 19 '21 at 08:53
-
Does this answer your question? [Increasing (or decreasing) the memory available to R processes](https://stackoverflow.com/questions/1395229/increasing-or-decreasing-the-memory-available-to-r-processes) – bttomio Feb 19 '21 at 08:59
-
Thank you, in the link you have sent me, they explain how to change the memory, but not what the functions specifically do and their difference, that is still unclear to me! – AUS85 Feb 19 '21 at 10:25
1 Answers
0
In a nutshell:
memory.size
is the memory in use by R
.
memory.limit
is the total amount of memory available to R
. If only a set amount is allocated, one can use the limit
argument to increase the memory size (if possible given system/OS constraints).
These only work on Windows, to be clear.

Colin H
- 600
- 4
- 9
-
OK, thanks. My memory.limit() is equals to my RAM (12 gb), and I thought this was the maximum amount of memory available to R. However, if I tape size=20000, I can exceed it without getting any error. How is it possible? where does the system get that additional memory? – AUS85 Feb 21 '21 at 12:45
-
R can't use more memory than your machine has available. You can tell it there's more memory than you have, but it won't have a practical effect. – Colin H Feb 22 '21 at 12:29
-
Hi, late for the discussion, but... for what I know, R can use also the virtual memory... – hamagust Apr 17 '22 at 19:20
-
memory.limit is no longer supported since version 4.2.0 (April 2022) – Aliton Oliveira Aug 25 '22 at 16:18