Skip to content

Running XPtr finalizer on exit #655

@jeroen

Description

@jeroen

[I tried posting on the mailing list but having issues with my UCLA email...]

I am experiencing odd behavior in packages that use XPtr (V8, tesseract, xml2) which is caused by the fact that Rcpp does not run the finalizer when R quits. This can lead to corrupted connections, memory leaks, etc.

The problem is that Rcpp hardcodes the call to R_RegisterCFinalizerEx with onexit = FALSE which makes that R skips over the finalizer when exiting.

Currently there is no way to fix this on the package side. Would there be a way to expose onexit as an option in Rcpp? Or better: make the default TRUE (imo you should always cleanup after yourself). But I can live with opt-in if there is a good reason for not finalizing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions