[R] Advice interfacing to an imaging library

Richard Beare Richard.Beare at cmis.csiro.au
Fri Jul 16 06:21:18 CEST 1999

Hi All,
I've done some work recently making some of our image analysis library
callable from R and Splus. Most of the C image functions use an abstract
data type, and R only sees a pointer to this. All memory allocation is
done by the library. This leads to some interesting problems. I'm
interested in your views about possible solutions.

1) assignment. something like a<-b, where a and b are image pointers
will only copy the pointer, not the image. We'd like to overload the <-
operator to call the library copy routine.

2) garbage collection. It is now easy to lose track of memory, and this
is likely to be significant because images are usually quite big. There
is a delete function in the library, so it is possible to dispose of
images manually, but an automated method would be nice. One option is to
keep a global list of all pointers returned from C function calls,
generate a list of all image class objects visible in R and compare the
two. Any pointers not on the image class list can be disposed. Does
anyone have any other ideas?

All advice welcome.

Richard Beare
Richard.Beare at cmis.csiro.au
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list