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
Iterators are not always released #152
Comments
We should implement return(), and that is probably OK for version 0.1 or 0.2. The last line of defense is to use the GC, which can be used with: A good example is at https://github.com/denoland/deno/blob/main/ext/fetch/26_fetch.js#L95 |
@espindola We do implement The issue is about the corner cases it does not cover. |
Nice, I missed that somehow. We should add a test to show that it is working :-) |
We now explicitly iterate over all resources and close them in |
The
Chisel.find_all()
JavaScript function returns an iterator that is backed by a RustQueryStreamResource
object, which needs to be released at some point.In JavaScript, you can implement a "return()" function for an iterator, which is called if the iterator is partially consumed.
For example, if you do the following (break out of iteration loop after first element):
The "return()" function is called to clean up. Our
Chisel.find_all()
iterator implementsrelease()
so this part is fine.However, if you do:
or even:
The "return()" function is not called, leaving the iterator alive. For us, this means that user can potentially leave
QueryStream
objects, for example, alive...The text was updated successfully, but these errors were encountered: