Make V8 stancjs in .OnLoad() - #946
Merged
Merged
Conversation
Contributor
|
I think the line with Here is a minimal example: https://github.com/ropensci/jsonld/blob/master/R/onload.R Otherwise it looks good. |
hsbadr
reviewed
Jun 16, 2021
hsbadr
reviewed
Jun 16, 2021
Member
|
LGTM. Thanks @SteveBronder! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
This hopefully fixes #945 and rstudio/rstudio#9282 by moving the stancjs setup logic to
.OnLoad().I know how busy @jeroen but Jeroen if you would have time to take a peek at this it would be very helpful. Essentially I think the problem is that v8 is a global object and calling
ctx$source(stanc_file)was causing memory to continuously be used. Callinggc()wouldn't help with this since v8 is a global.I also removed
allow_optimizationsfrom stanc and friends. Those are super experimental and can potentially produce incorrect C++ and are not ready to be exposed to users. My big concern here is that users are going to see "allow optimizations" and go "well of course yes" without actually knowing they are experimental / dangerous. We are also working right now to have optimization levels like 1,2,3 etc. so that interface would change anyway.Intended Effect:
Fixes the above memory leaks
How to Verify:
I'm actually not sure how to verify this I was just taking an example model and doing
and checking the memory usage via htop to see if it kept going up.
Side Effects:
Documentation:
Reviewer Suggestions:
Copyright and Licensing
Please list the copyright holder for the work you are submitting (this will be you or your assignee, such as a university or company): Steve Bronder
By submitting this pull request, the copyright holder is agreeing to license the submitted work under the following licenses: