[R] Memory issues

Chris Howden chris at trickysolutions.com.au
Mon Jan 17 01:39:53 CET 2011

Hi Emmanuel,

Try the following:

1) removing unnecessary programs from memory, this might give u a larger
contiguous memory block for R
2) remove unnecessary data from R's memory, so many of the preceding data
sets U no longer need can be removed. use the rm() command. U might need
to run gc() after this to insure the new memory is available
3) make sure U've assigned as much memory to R as possible using

And make sure u have r's

Chris Howden
Founding Partner
Tricky Solutions
Tricky Solutions 4 Tricky Problems
Evidence Based Strategic Development, IP Commercialisation and Innovation,
Data Analysis, Modelling, and Training
(mobile) 0410 689 945
chris at trickysolutions.com.au

-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
On Behalf Of Emmanuel Bellity
Sent: Monday, 17 January 2011 4:53 AM
To: r-help at r-project.org
Subject: [R] Memory issues


I have read several threads about memory issues in R and I can't seem to
find a solution to my problem.

I am running a sort of LASSO regression on several subsets of a big
For some subsets it works well, and for some bigger subsets it does not
work, with errors of type "cannot allocate vector of size 1.6Gb". The
occurs at this line of the code:

   example <- cv.glmnet(x=bigmatrix, y=price, nfolds=3)

It also depends on the number of variables that were included in

I tried on R and R64 for both Mac and R for PC but recently went onto a
faster virtual machine on Linux thinking I would avoid any memory issues.
was better but still had some limits, even though memory.limit indicates

Is there anyway to make this work or do I have to cut a few variables in
matrix or take a smaller subset of data ?

I have read that R is looking for some contiguous bits of memory and that
maybe I should pre-allocate the matrix ? Any idea ?

Many thanks


	[[alternative HTML version deleted]]

R-help at r-project.org mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list