Displaying 1 result from an estimated 1 matches for "rindex_finalize".
2007 Aug 03
2
How to properly finalize external pointers?
...tely.
Shouldn't R_ClearExternalPtr call the finalizer and then unregister it? (this would also work when removing the SEXP external pointer object is difficult because it was handed over to the closing function directly as a parameter)
Best regards
Jens Oehlschl?gel
// C-code
static void rindex_finalize(SEXP extPtr){
pINT ptr = R_ExternalPtrAddr(extPtr);
if(ptr){
Free(ptr);
Rprintf("finalized\n");
}else{
Rprintf("nothing to finalize\n");
}
return;
}
SEXP rindex_open(
SEXP Sn
){
int i,n = INTEGER(Sn)[0];
pINT ptr = Calloc(sizeof(INT)*n, INT);
SEXP...