In my R package , the C code which implements the function allocates some memory for usage. What happens to this memory ? Will it be under R's GC's radar or would it be a memory leak ? If its under R's garbage collection , will this memory be reclaimed back ?
I have a huge 5 GB of data to be allocated in R's server process which is running as a server. Here it would be a good idea if i can allocate this memory out of GC's radar like we have outside heap memory allocation in Java. So basically , can i allocate a huge amount of memory in my C code without R not disturbing that memory ?
I am planning to use malloc or calloc to allocate memory.
This is described fairly clearly in "Writing R Extensions" -- one uses R variants of
calloc()
/malloc()
that access the same pool of memory. That way R cangc()
these things, and why you needPROTECT()
anndUNPROTECT()
.From Chambers' Software for Data Analysis: