[Bioc-devel] IntAE buffers needs to be freed or not??
hpages at fhcrc.org
Sat Jul 20 02:05:30 CEST 2013
No you don't. At least not currently, because those buffers use
transient memory which will be freed automatically when .Call()
returns. However, I might change the implementation of the IntAE
buffers to use user-controlled memory at some point (malloc() is
so much faster than R_alloc(), about 10x-20x for me), so when this
happens you will need to do something like
unless you call your .Call entry point with .Call2 (defined in the
IRanges package), which will take care of doing that for you. I highly
recommend you do that if you use the IntAE buffers in your C code or
if you call C functions that use the IntAE buffers (and a lot of C
functions in IRanges and Biostrings use them).
On 07/19/2013 03:35 AM, Ge Tan wrote:
> Hi all,
> I am using the IntAE buffers (taken from IRanges packages) in my .Call() code.
> Sample code in C:
> IntAE width_buf;
> width_buf = new_IntAE(0, 0, 0);
> IntAE_insert_at(&width_buf, IntAE_get_nelt(&width_buf), width);
> PROTECT(width = new_INTEGER_from_IntAE(&width_buf));
> So after using .Call(), do I need to run something like ".Call("AEbufs_free", PACKAGE="IRanges")" in R?
> I got this from the IRanges/src/AEbufs.c.
> Bioc-devel at r-project.org mailing list
Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M1-B514
P.O. Box 19024
Seattle, WA 98109-1024
E-mail: hpages at fhcrc.org
Phone: (206) 667-5791
Fax: (206) 667-1319
More information about the Bioc-devel