[R] Memory hungry routines

ALBERTO VIEIRA FERREIRA MONTEIRO albmont at centroin.com.br
Tue Dec 30 12:20:36 CET 2014

Thanks to Duncan, Hadley and Henrik.

Duncan, I used Rprof and could pinpoint the critical routine that was
doing the memory crash.

Henrik, you got it right: the culprit was a big matrix of integers,
but where some of its fields are filled with -Inf and Inf. This matrix
is global, it's used only once, it does not consume too much memory,
and it should be harmless, but...

Hadley, your link to memory allocation and management helped to
identify the problem. I did a very stupid think, I added some debug in
the critical routine that duplicated it at each iteration of a loop...
So that big matrix with integers and Infs and -Infs was being copied
several times, killing memory needlessly.

Thanks for all the help.

"I got 99 problems but you won't be one"

Alberto Monteiro

More information about the R-help mailing list