[Rd] Checking for user interrupt in a .C() call without without triggering a non-local exit.

Pavel N. Krivitsky pavel at stat.washington.edu
Tue Feb 27 03:39:19 CET 2007


An R package on which I am working makes a series of very
computationally-intensive and complex .C() calls, that I would like to
make interruptible. However, calling R_CheckUserInterrupt() causes a
non-local exit, so the memory allocated by malloc() is never freed. The
way the code is structured, it might not be practical to replace all the
malloc() calls with R_alloc() calls.

The question is, can I somehow detect a user interrupt and handle it
gracefully in my own code? A similar question was posed a few months ago
( http://tolstoy.newcastle.edu.au/R/devel/06/08/6415.html ), but didn't
get any response. Has anything changed since?

              Pavel Krivitsky

More information about the R-devel mailing list