Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create 1 preserve list per compilation unit #331

Merged

Conversation

DavisVaughan
Copy link
Member

@DavisVaughan DavisVaughan commented Aug 2, 2023

Closes #330 (see this issue for full discussion)
Closes #268 (as there is no longer a global option)

This is the minimal amount of work to move from a global protection list to 1 protection list per compilation unit.

In two follow up PRs I will:

  • Remove release_all(), require R >= 3.5.0, remove CPP11_USE_PRESERVE_OBJECT and its related code (not much), remove the documentation section about R 3.5.0 and the tradeoffs about unwind-protect (Require R >=3.5.0 and remove release_all() #332)
  • Talk to Lionel about how best to include the package name in a debug macro somehow, to make it easier to debug protection issues

Copy link
Member

@lionel- lionel- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On further thought I think it'd still be nicer to store in the calling package's namespace. Not only for graph-domination purposes but also it'd make it possible to add some R-level tools in cpp11 to inspect all objects currently created by your cpp11 code, which might be useful in debugging situations.

It shouldn't be too hard to do that once we've added a symbol in the init file that represents the package namespace. This will make it possible to grab the namespace environment to get the precious list in the first run. And the init list could be initialised from the C-level init function.

Not a blocker by any means, this PR is already good for now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants