Skip to content

StatementIterator leaks if not run to completion #457

Open
@rhashimoto

Description

@rhashimoto

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions