Consider the C (or C++) code called from the .Call interface:
SEXP foo() {
  SEXP *p = PROTECT(allocVector(REALSXP, 10));
  ...
  UNPROTECT(1);
  return p;
}

Why is there no danger that the allocated memory will be garbage
collected after the UNPROTECT, but before the return of p?

I have used code like this for some time and have never had a
problem, but I'm not sure if/why it is guaranteed to work.

Thanks,
Dominick

	[[alternative HTML version deleted]]

