Skip to content
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

Explain expected contract for ownership. #261

Merged
merged 1 commit into from
Jan 23, 2025
Merged
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
2 changes: 1 addition & 1 deletion doc/leak_tracking/TROUBLESHOOT.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ switch to [more complicated troubleshooting](#more-complicated-cases).

Follow the rules to avoid/fix notGCed and notDisposed leaks:

1. **Ownership**. Every disposable object should have clear owner that manages its lifecycle.
1. **Ownership**. Every disposable object should have clear owner that manages its lifecycle. Normally, it it creator of the object. If it is different, the exception should be clearly documented.
2. **Disposal**. The owner should invoke the object's `dispose`.
3. **Release**. The owner should null reference to the disposed object, if its `dispose` happens earlier than owner's disposal.
4. **Weak referencing**. Non-owners should either link the object with WeakReference, or make sure to
Expand Down
Loading