[R] multicore, mclapply memory problem

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Jun 29 09:17:12 CEST 2012


On 29/06/2012 07:59, Fabrice Tourre wrote:
> Dear list,
>
> I am using mclapply(from multicore) to use multiple cores on one
> server. If I do not use mclapply, just one core, my R problem will use
> 4G memory. When I use mclapply and set mc.cores =10, each core will
> use 4G memory. So totally it will use 40G memory. Is it possible let
> each core to share some memory on the same server?

Well, actually it does this automatically ....

On a decent OS (despite the posting guide, you did not tell us yours), 
forking will share pages between the forked copies until the page is 
changed.  So in particular any large R objects created before forking 
will remain shared between the worker processes.

And BTW, package multicore was superseded by parallel last year.


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-help mailing list