[R] Memory problem

Jeff Newmiller jdnewmil at dcn.davis.ca.us
Wed Apr 6 16:13:15 CEST 2016


As Jim has indicated, memory usage problems can require very specific diagnostics and code changes,  so generic help is tough to give. 

However, in most cases I have found the dplyr package to be more memory efficient than plyr, so you could consider that. Also, you can be explicit about only saving the minimum results you want to keep rather than making a list of complete results and extracting results later. 
-- 
Sent from my phone. Please excuse my brevity.

On April 6, 2016 4:39:59 AM PDT, Amelia Marsh via R-help <r-help at r-project.org> wrote:
>Dear R Forum,
>
>I have about 2000+ FX forward transactions and I am trying to run 1000
>simulations. If I use less no of simulations, I am able to get the
>desired results. However, when I try to use more than 1000 simulations,
>I get following error.
>
>> sorted2 <- ddply(sorted, .(currency_from_exch, id), mutate,
>change_in_mtm_bc = mtm_bc - mtm_bc[1]) 
>
>Error: cannot allocate vector of size 15.6 Mb 
>
>
>In addition: Warning messages: 
>1: Reached total allocation of 3583Mb: see help(memory.size) 
>2: Reached total allocation of 3583Mb: see help(memory.size) 
>3: In output[[var]][rng] <- df[[var]] : 
>Reached total allocation of 3583Mb: see help(memory.size) 
>4: In output[[var]][rng] <- df[[var]] : 
>Reached total allocation of 3583Mb: see help(memory.size) 
>5: In output[[var]][rng] <- df[[var]] : 
>Reached total allocation of 3583Mb: see help(memory.size) 
>6: In output[[var]][rng] <- df[[var]] : 
>Reached total allocation of 3583Mb: see help(memory.size) 
>7: In output[[var]][rng] <- df[[var]] : 
>Reached total allocation of 3583Mb: see help(memory.size) 
>8: In output[[var]][rng] <- df[[var]] : 
>Reached total allocation of 3583Mb: see help(memory.size)
>
>
>When I checked -
>
>> memory.size() 
>[1] 846.83 
>> memory.limit() 
>[1] 3583
>
>
>The code is bit lengthy and unfortunately can't be shared.
>
>Kindly guide how this memory probelm can be tackled? I am using R x64
>3.2.0
>
>Regards
>
>Amelia
>
>______________________________________________
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

	[[alternative HTML version deleted]]



More information about the R-help mailing list