[Rd] allocation of large matrix failing

James Bullard bullard at berkeley.edu
Tue Jul 12 23:05:27 CEST 2005

Hello, this is probably something silly which I am doing, but I cannot
understand why this allocation is not happening.

Here is a my C code which tries to allocate a list of size  333559, and
then a matrix of size 8*333559
I thought I might be running into memory problems, but R is not even
using that much (I start R with
more memory and it stays constant) Also, I start R as I normally do and
I allocate a matrix of that size
and it returns instantly, so I am inclined to think that this is not a
memory/GC issue, but I submit it
may be.
int numHits = seq.GetNumberHits();

Rprintf("numHits:%d\n", numHits);
Rprintf("before allocation...\n");

SEXP oligos, matrix;
PROTECT(oligos = NEW_LIST(numHits));
Rprintf("allocated oligo list...\n");

PROTECT(matrix = NEW_INTEGER(numHits*8));
Rprintf("entering looop...\n");

entering sequence loop.
before allocation...
allocated oligo list...

It hangs here everytime (never printing "entering loop..." - i have
waited like 10 minutes). If I remove the 8 then it completes.
Essentially I want to allocate a vector of that length and then
dimension it into a matrix, but I cannot see why this does not work.

debian 2.6
R 2.1.0

Thanks as always for any insight.


More information about the R-devel mailing list