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

Q: re, Example does not release model reference #2

Open
DanRathbun opened this issue Apr 26, 2020 · 2 comments
Open

Q: re, Example does not release model reference #2

DanRathbun opened this issue Apr 26, 2020 · 2 comments
Labels
documentation Improvements or additions to documentation

Comments

@DanRathbun
Copy link

In the "Using SketchUp Live C API" example ...
https://github.com/SketchUp/sketchup-live-c-api/blob/master/docs/using-live-c-api.md#example

The ruby_num_faces function does not release it's reference to the "live" model.

The primer page for standalone C API use has an example comment that says to always release the model reference, viz:

  // Must release the model or there will be memory leaks
  SUModelRelease(&model);

Q: Is releasing the model reference not needed for the "live" C API use ?

Q: What other differences are there from what is described in the standalone use primer section ...
Memory Management in the SketchUp C API ?

@thomthom
Copy link
Member

Q: Is releasing the model reference not needed for the "live" C API use ?

No, the model reference should not be released because the model is owned by SketchUp. In standalone API usage you need to do The SUCreate* function mention you need to release the model you create with them - because you will be owning them.

SUApplicationGetActiveModel doesn't mention anything about ownership, we can add a note about that in its documentation to make it clear that the application owns the model returned.

Q: What other differences are there from what is described in the standalone use primer section ...
Memory Management in the SketchUp C API ?

None really, you are only supposed to release the objects you own.

@thomthom thomthom added the documentation Improvements or additions to documentation label Apr 27, 2020
@DanRathbun
Copy link
Author

Add to docs or create FAQ page, whatever is best.

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

No branches or pull requests

2 participants