The Wayback Machine - https://web.archive.org/web/20230129055746/https://github.com/sql-js/sql.js/issues/457
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

StatementIterator leaks if not run to completion #457

Open
rhashimoto opened this issue May 20, 2021 · 2 comments
Open

StatementIterator leaks if not run to completion #457

rhashimoto opened this issue May 20, 2021 · 2 comments
Labels

Comments

@rhashimoto
Copy link

A statement provided by StatementIterator can be leaked until the Database is closed if the iterator is not run to completion. A statement is not freed until next is called for the following iteration, which might not happen if, for example, a for...of loop is exited via break, return, or thrown exception.

Careful coding can work around this issue, but that code will also be uglier and harder to read. A better fix would be to implement the optional return method on the iterator to reclaim its resources, as that will be automatically called on early loop termination.

@lovasoa lovasoa added the bug label May 20, 2021
@lovasoa
Copy link
Member

lovasoa commented May 20, 2021

Good catch ! Are you interested in making a PR ?

@rhashimoto
Copy link
Author

@lovasoa Honestly I find it difficult to work in the sql.js tree because the coding standard is ES5 and you have to run emcc for changes that only affect the Javascript side. If you can get someone to help improve the project infrastructure, it would be a lot easier to dash off a fix - I would do it even though I can't use it (I need an asynchronous API).

@rhashimoto rhashimoto removed their assignment May 20, 2021
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