There are conflicting objectives in deciding how to treat R objects obtained through the RCall interface relative to the RCall interface. It is desirable to have Julia and R access the same memory for the contents if, for example, you want to modify a value in Julia and have the modification available in R. In that case you want both systems to agree on who gets to do garbage collection and whether the contents are protected. On the other hand, R is conservative about protecting objects in function calls (an R function should not modify the contents of an argument) which can lead to extravagant memory usage is you want to update a large R object for, say, new parameter values.
I think the best solution is to establish a naming convention about who owns the memory and who protects it. RCall has a 'rawvector' method that returns the unprotected contents of an R object as a Julia vector. I think that, in keeping with the "consenting adults" approach of Julia, there should be a way to return the raw, potentially unprotected, vector. Currently there is a DataArray method for various types of R objects that makes them visible as DataArray types. These should probably be protected if they are to share the same storage between R and Julia. To avoid excessive memory usage, there should be a Julia finalizer method that calls the R interface function R_ReleaseObject on the object (which means that the original R SEXP has to be retained somewhere). I think this will require new types that extend DataArrays.AbstractDataArray. I can't see an easy way of retaining the R SEXP for a DataArrays.DataArray type.
Another situation that Randy Lai and I were discussing in issue #7 is the case where an R object is immediately copied into a Julia object. It is probably not a big deal to protect and unprotect the object for the duration of the copy operation.
Right now it seems to me that there should be types with names like RDataArray, RPooledDataArray and perhaps RDataFrame that use the storage from R but protect it from garbage collection and retain the R SEXP for a finalizer. Calling DataArray or DataFrame on such an object results in its being copied to memory locations allocated by Julia. Does that make sense?