I have noticed that when I parallelize code in R 3.5.1 functions take up a lot more RAM in comparision to when running on one processor. Is there a way to release RAM?
Subquestion: Increasing memory limit above my RAM in 64-bit R seems to have no effect while parallelizing. Is there a way to set it higher, if it is possible?
library(doParallel)
cl <- makeCluster(detectCores(), type='PSOCK')
registerDoParallel(cl)
somefunction(x)
gc(reset=T) ## does nothing
function2(y) ## rans out of RAM, cause R holds onto variables from somefunction()
registerDoParallel()