Skip to content

Avoid retain cycles in parent pointers #2621

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

Merged
merged 1 commit into from
Mar 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ class LevelDbRemoteDocumentCache : public RemoteDocumentCache {
FSTMaybeDocument* DecodeMaybeDocument(absl::string_view encoded,
const model::DocumentKey& key);

FSTLevelDB* db_;
// This instance is owned by FSTLevelDB; avoid a retain cycle.
__weak FSTLevelDB* db_;
FSTLocalSerializer* serializer_;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ class MemoryMutationQueue : public MutationQueue {
*/
int IndexOfBatchId(model::BatchId batch_id);

FSTMemoryPersistence* persistence_;
// This instance is owned by FSTMemoryPersistence; avoid a retain cycle.
__weak FSTMemoryPersistence* persistence_;
/**
* A FIFO queue of all mutations to apply to the backend. Mutations are added
* to the end of the queue as they're written, and removed from the front of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ class MemoryQueryCache : public QueryCache {
void SetLastRemoteSnapshotVersion(model::SnapshotVersion version) override;

private:
FSTMemoryPersistence* persistence_;
// This instance is owned by FSTMemoryPersistence; avoid a retain cycle.
__weak FSTMemoryPersistence* persistence_;

/** The highest sequence number encountered */
model::ListenSequenceNumber highest_listen_sequence_number_;
/** The highest numbered target ID encountered. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ class MemoryRemoteDocumentCache : public RemoteDocumentCache {
/** Underlying cache of documents. */
model::MaybeDocumentMap docs_;

FSTMemoryPersistence *persistence_;
// This instance is owned by FSTMemoryPersistence; avoid a retain cycle.
__weak FSTMemoryPersistence *persistence_;
};

} // namespace local
Expand Down