On Fri, 16 Mar 2007, Martin Morgan wrote:
> Is there a (C or R) function to invalidate the relevant parts of SEXP
> / data that are inaccessible? My problem is in tracking down
> protection and other memory mismanagement bugs, where I have to rely
> on luck to invalidate or overwrite data to trigger a detectable
> error. This makes it hard to track down a bug (it sometimes doesn't
> occur), or to know that a patch fixes the problem.
>
Under Valgrind when R is compiled --with-valgrind-instrumentation=2 the
code walks the list of newly freed SEXPs and marks them as inaccessible
(which is one reason why it is so slow).
I don't know of any other facilities to do what you want.
-thomas