'How to increase memory in R

I am running R 64 bit on windows 7 64 bit. While running my script, I get an error message that cannot allocate a vector of size x (in my case about 200MB). My data.frame has about 200.000 rows, not more. How can it happen that there is not enough storage space to allocate another vector? I know that the operation itself works since the script runs through with a smaller, subsetted file.

I know too that this question has been asked before but none of the answers solved my problem. there are many different answers out-there which one is correct? Is it related to the RAM of the system or of the memory of R?

I increased the memory size manually:

memory.limit()
# set max memory usage is 2G
memory.size(max=10000)

Then r says that the memory limit is 10.000

memory.limit()
[1] 10000 

but still there is the same error. it is even the same size of the vector that cannot be allocated.

I cleaned up my computer and set more space free on my drive too. but it doesn´t change anything either.

On what is the memory size dependent and how can I increase it?



Solution 1:[1]

Like people have been commenting, one would need to see your actual code for more specific answers.

However, a couple of general things you could consider are:

i) using remove() or rm() functions within your script on auxiliary / intermediate objects / results

ii) read the help of the gc() function, which triggers the garbage collection explicitly (which should usually not be necessary but there are cases where this is justified)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 RolandASc