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

fix(js): free key and entry objects #107

Merged

Conversation

genaris
Copy link
Contributor

@genaris genaris commented Mar 2, 2023

As there is not a destructor in JS, objects must be freed manually. This PR attempts to free any native object after it is used, making life easier to consumer applications.

If this approach is correct, the only objects an app using this library should care about is Key (for which I added the missing call to keyFree).

@blu3beri let me know if concepts applied here are correct so I can replicate for anoncreds-rs.

Signed-off-by: Ariel Gentile <gentilester@gmail.com>
@genaris genaris mentioned this pull request Mar 2, 2023
@andrewwhitehead
Copy link
Contributor

It looks like EntryLists are freed in the Scan implementation which is good as well. It seems fairly easy for a user to accidentally leak sessions and run out of active connections though, it might be better to use a callback interface for working with open sessions and transactions, and close automatically after it runs.

@andrewwhitehead andrewwhitehead merged commit 093599b into openwallet-foundation:main Mar 3, 2023
@genaris genaris deleted the fix/free-objects branch March 3, 2023 00:57
jamshale pushed a commit to jamshale/askar that referenced this pull request Aug 18, 2024
…jects

fix(js): free key and entry objects
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants