[Rd] How to debug: Cons memory exhausted

Simon Urbanek simon.urbanek at r-project.org
Thu Jun 24 18:53:54 CEST 2010


On Jun 20, 2010, at 11:15 AM, Saptarshi Guha wrote:

> Hello,
> I get an error when binary structures from a pipe
> 
> 'Error: cons memory exhausted (limit reached?)' (but R does not crash)
> 
> This is probably due to some bug in my code, but occurs after reading
> about 85K pairs of RAWSXP objects (each < 20 bytes).
> 
> I do not have any explicit calls to malloc/calloc
> 

It has nothing to do with malloc/calloc - it means that the number of nodes (=R objects) has reached the limit. Normally the limit is soft so it will adjust up to SIZE_MAX (for all practical purposes unlimited on 64-bit machines). However, in low-memory conditions it may not be possible to allocate more heap space so that is more likely your limit.


> I'm going through my code and have inserted the (brute force) printf
> statements
> my question is: Does anybody have an advice on debugging this particular
> error?
> 

You can set a breakpoint on mem_err_cons. In general it means that you are simply running out of memory.

Cheers,
Simon



More information about the R-devel mailing list