Skip to content

Commit

Permalink
Fix potential memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
pluma committed Oct 6, 2020
1 parent b8353d2 commit a993de1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ This driver uses semantic versioning:
- A change in the major version (e.g. 1.Y.Z -> 2.0.0) indicates _breaking_
changes that require changes in your code to upgrade.

## [Unreleased]

### Fixed

- Fixed a potential memory leak in cursor batch handling

## [7.0.2] - 2020-09-25

### Fixed
Expand Down Expand Up @@ -1103,6 +1109,7 @@ For a detailed list of changes between pre-release versions of v7 see the

Graph methods now only return the relevant part of the response body.

[unreleased]: https://github.com/arangodb/arangojs/compare/v7.0.2...HEAD
[7.0.2]: https://github.com/arangodb/arangojs/compare/v7.0.1...v7.0.2
[7.0.1]: https://github.com/arangodb/arangojs/compare/v7.0.0...v7.0.1
[7.0.0]: https://github.com/arangodb/arangojs/compare/v6.14.1...v7.0.0
Expand Down
5 changes: 4 additions & 1 deletion src/cursor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,10 @@ export class BatchedArrayCursor<T = any> {
return undefined;
}
const batch = this._batches.shift();
return batch && [...batch.values()];
if (!batch) return undefined;
const values = [...batch.values()];
batch.clear(true);
return values;
}

/**
Expand Down

0 comments on commit a993de1

Please sign in to comment.