Hi Ge,

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

  .Call("AEbufs_free", PACKAGE="IRanges")

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).

Cheers,
H.

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);
for(…){
     IntAE_insert_at(&width_buf, IntAE_get_nelt(&width_buf), width);
}
PROTECT(width = new_INTEGER_from_IntAE(&width_buf));
UNPROTECT(1);
return(width);

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.

Thanks!
Ge                                      
_______________________________________________
Bioc-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/bioc-devel


--
Hervé Pagès

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: hpa...@fhcrc.org
Phone:  (206) 667-5791
Fax:    (206) 667-1319

_______________________________________________
Bioc-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/bioc-devel

Reply via email to