R: Deallocate the C data structures corresponding to an...

ergm_Cstate_clear {ergm} | R Documentation

## Deallocate the C data structures corresponding to an `ergm_state` left over from a `.Call()` run.

### Description

This function is exported for use by other packages that use the `ErgmState` C API. It should be used as a part of an `on.exit()` call in the function that calls the C routine if the C routine contains `R_CheckUserInterrupt()` calls, in order to ensure that memory is freed if the routine is interrupted.

### Usage

    ergm_Cstate_clear()

### See Also

`ergm_state`

### Examples

    ## Not run:
    long_run <- function(...){
      on.exit(ergm_Cstate_clear())
      .Call("long_run",...)
    }

    ## End(Not run)

[Package ergm version 4.2.2 Index]