A finalization function
conFinalizer is registered via the external pointer mechanism when the connection is created. This function is executed when a garbage collection event finds that the connection is no longer reachable from the running R program. For more information on the finalization and external pointer mechanism, see the Writing R Extensions manual. The function
con_destroy, which calls
con_close1 function calls the
destroy methods specified in the
struct Rconn structure associated with the connection, if necessary, and deallocates memory associated with character re-encoding and the
class character strings. Finally, on return to
con_destroy, memory associated with the
struct Rconn structure is released.
con_destroy may also be called if the
open method of an initialized connection fails, and is always called following a call to the R function
close on non-standard, non-sink connections.