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

Rework c-api memory model #421

Open
leonardt opened this issue Feb 22, 2018 · 2 comments
Open

Rework c-api memory model #421

leonardt opened this issue Feb 22, 2018 · 2 comments
Assignees
Labels
Milestone

Comments

@leonardt
Copy link
Collaborator

leonardt commented Feb 22, 2018

For routines involving the creation of arrays (e.g. for passing a map as an array of keys and values), we should either:

  • (a) have the user pass in the allocated array (so they'll need to call another API function to get the size of the array they should allocate). Then the user would be explicitly responsible for freeing the memory
  • (b) define a calling convention such that it's the user's responsibility to free the memory (can be through an API call) after they're done with it

This should clean up the memory model such that the context doesn't need to manage memory for the c-api

@leonardt leonardt added the c-api label Feb 22, 2018
@leonardt leonardt self-assigned this Feb 22, 2018
@leonardt leonardt added this to the Spring 2018 milestone Feb 22, 2018
@rdaly525
Copy link
Owner

I like (b) a bit better. I think this is what LLVM does for their C api, although I will need to confirm

@leonardt
Copy link
Collaborator Author

Makes sense to me

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

No branches or pull requests

2 participants