[Rd] asking for suggestions: interface for a C++ class
Yurii Aulchenko
i.aoultchenko at erasmusmc.nl
Fri Sep 4 22:54:30 CEST 2009
Dear All,
I would like to have an advice for designing an R library, and thought
that R-devel may be the best place to ask given so many people who are
highly expert in R are around.
We are at an early stage of designing an R library, which is
effectively an interface to a C++ library providing fast access to
large matrices stored on HDD as binary files. The core of the C++
library is relatively sophisticated class, which we try to "mirror"
using an S4 class in R. Basically when a new object of that class is
initiated, the C++ constructor is called and essential elements of the
new object are reflected as slots of the R object.
Now as you can imagine the problem is that if the R object is removed
using say "rm" command, and not our specifically designed one, the C++
object still hangs around in RAM until R session is terminated. This
is not nice, and also may be a problem, as the C++ object may allocate
large part of RAM. We can of cause replace generic "rm" and "delete"
functions, but this is definitely not a nice solution.
Sounds like rather common problem people may face, but unfortunately I
was not able to find a solution.
I will greatly appreciate any suggestions.
many thanks in advance,
Yurii
More information about the R-devel
mailing list