Skip to content

memory management in C code

2 messages · Vineeth Mohan, Rui Barradas

#
Hello,

This is explained in Writing R Extensions, Section 6.1 file R-exts.pdf 
in your distribution of R, folder doc.
There are two types of functions to allocate memory in C functions 
called from R code.

1. R_alloc() - the memory is automatically reclaimed at the end of the 
function call.
2. Calloc/Realloc - you must call Free() [ uppercase, not free() ] at 
the end of the function call.

Hope this helps,

Rui Barradas
Em 07-12-2012 12:40, Vineeth Mohan escreveu: