We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0321343 commit 16a4dd5Copy full SHA for 16a4dd5
test.js
@@ -291,6 +291,20 @@ test('values=false', function (t) {
291
})
292
293
294
+// It's important to keep a reference to the iterator at least until we end,
295
+// to prevent GC of the iterator and therefor its db (esp. for native addons).
296
+test('keeps a reference to the iterator', function (t) {
297
+ var it = db.iterator()
298
+ var stream = iteratorStream(it)
299
+
300
+ stream.on('close', function () {
301
+ t.is(stream._iterator, it, 'has reference')
302
+ t.end()
303
+ })
304
305
+ stream.resume()
306
+})
307
308
function monitor (iterator, stream, onClose) {
309
var order = []
310
0 commit comments