Cherrypick gc features from stable-gluegunfw#537
Conversation
|
By the way, without callbacks there is no good way to write tests for this feature. I will add them at some point if/when they are merged as well. |
|
Alright, master is ready for this PR now, I also merged the GC threshold getter API. If you rebase and get the build green we are good to go! |
|
In theory it is ok. |
src/js/core/index.js
Outdated
| run: () => core._gc.run(), | ||
|
|
||
| set enabled(value) { | ||
| if (value === true) { |
There was a problem hiding this comment.
| if (value === true) { | |
| if (value) { |
src/js/core/index.js
Outdated
| if (_gc_state.enabled) { | ||
| core._gc.setThreshold(value); _gc_state.threshold = value; | ||
| } else { | ||
| core._gc.setThreshold(-1); |
There was a problem hiding this comment.
Shouldn't we store the threshold and apply it if the user then flips the enabled switch? Otherwise it will be lost.
|
You can make the linter happy by running the formatter yourself: npm run format Codegen relies on the node version, make sure you are using 20. I can take care of those myself if you can't. |
|
I fixed the logic since it was all a bit wonky.
I don't have a node 20 instance on this machine, if you could do that it would be better. |
|
Ah I meant |
|
Not really, but it is the usual culprit |
Restricted version of #520, waiting for upstream support of the threshold getter.
I will keep it as draft up to when the quickjs submodule is updated to a commit supporting the getter.