Hello,
The Writing R extensions manual section 6.1.1 describes the transient
memory allocation function R_alloc, and states that memory allocated
by R_alloc is automatically freed after the .C or .Call function is
completed.  However, based on my understanding of R's memory handling,
as well as some test functions I have written, I suspect that this is
not quite accurate.  If the .Call function returns an external pointer
to something created with R_alloc, then this object seems to stick
around after the .Call function is completed, and is subject to
garbage collection once the external pointer object is removed.

Does anyone know, can I count on this behavior on any platform?  It
would certainly be useful for me.  ie, Can I create an external
pointer to something created with R_alloc, and trust that it will not
be free'd until the external pointer object is removed?  And if so,
should the manual be edited to describe this behavior?
Thanks,
Melissa Hubisz

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to