You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I cannot seem to work out if collection queries are automatically closed when a object is garbage collected. Say I have this class:
import 'package:cloud_firestore/cloud_firestore.dart';
class ExampleClass {
final Stream<QuerySnapshot> collectionStream;
ExampleClass(String collectionName)
: this.collectionStream =
FirebaseFirestore.instance.collection(collectionName).snapshots();
}
If I instantiate the class, use it, and then lose all references to the instance, expecting it to be garbage collected, what will happen? Will the stream be closed? If there are updates to the collection, will the reads happen (and thus be billed for?) Or perhaps the existence of an open stream will prevent the instance from being garbage collected?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I cannot seem to work out if collection queries are automatically closed when a object is garbage collected. Say I have this class:
If I instantiate the class, use it, and then lose all references to the instance, expecting it to be garbage collected, what will happen? Will the stream be closed? If there are updates to the collection, will the reads happen (and thus be billed for?) Or perhaps the existence of an open stream will prevent the instance from being garbage collected?
Beta Was this translation helpful? Give feedback.
All reactions