2
I’m running some analysis and would like to fix the use of RAM in R to be able to use other software simultaneously without any problem. So I’d like to, for example, limit the 4gb of RAM memory, even if it makes the analysis take longer.
I tried this strategy available here, where a limit is created in the properties of the program, but it does not work.
I am currently working with calculation of distance matrices 62 variables x 60 thousand observations.
Another option was to use H20, but I end up using more RAM because I have to call JAVA.
I don’t understand anything of [tag:r], but the whole problem seems to me some more "error" of how he designed the script, for example, the LACK of a delay between a series of operations and another would cause such a problem if the algorithm is written well and with a good strategy it is likely that memory consumption rarely needs absurd 4GB (all this seems to me an exaggeration, but I may be wrong).
– Guilherme Nascimento
Tried this: https://stackoverflow.com/a/1395256/1518921 ?
– Guilherme Nascimento
Try
memory.limit(size = 4000)
. If you are concatenating multiple analyzes, it is also a good idea to clear the workspace at each step, e.g. saving objects in files, deleting objects that will no longer be used and usinggc()
to wipe the memory.– Carlos Eduardo Lagosta
Thanks @Guilhermenascimento, maybe I’m programming the code a little wrong. Because I am doing a relatively heavy analysis, I will try to introduce time between them. R is occupying my RAM completely.
– Joyce Maia
@Carloseduardolagosta, thanks for the statement. I didn’t know the gc() command and I will test the memory limit this way. In fact I am accumulating mt objects throughout the code, I will try to eliminate them. Every case I think q analysis of Space Join is kind of heavy.
– Joyce Maia
@Carloseduardolagosta gave this error: In memory.limit(size = 4000) : cannot decrease memory limit: Ignored, I’m looking for how to resolve, but nothing solvable so far
– Joyce Maia
If you’re running a heavy analysis and/or a lot of data, then go for code optimization instead of trying to limit the use of RAM. But this is a very broad topic.
– Carlos Eduardo Lagosta
Which Operating System are you running the analysis on? Share the result of
sessionInfo()
, can help us understand the case– Tomás Barcellos
I am using Windows 7 64bits, the version of R is 3.6.1. R version 3.6.1 (2019-07-05) Platform: x86_64-W64-mingw32/x64 (64-bit) Running under: Windows 7 x64 (build 7601) Service Pack 1 The analysis in thesis is simple in terms of commands is three commands: 2 are to open the files and the last is to perform space Join between polygon and points Shape.
– Joyce Maia