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

Add instruction to start tracking instances of ChangeNotifier earlier. #130

Merged
merged 3 commits into from
Aug 24, 2023
Merged
Changes from 2 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
16 changes: 14 additions & 2 deletions doc/TROUBLESHOOT.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,21 @@ you need to run it with flag `--debug` or `--profile`
([not available](https://github.com/flutter/flutter/issues/127331) for Flutter tests),
or, if it is a test, by clicking `Debug` near the test name in IDE.

## Complicated cases
## More complicated cases

### 1. Static or global object causes notGCed leaks
### 1. It is not clear who owns ChangeNotifier

[ChangeNotifier] is disposable and is tracked by leak_tracker.

But, as it is mixin, it does not have its own constructor. So, it
communicates object creation in first `addListener`, that results
in creation stack trace pointing to `addListener`, not to constructor.

To make debugging easier, invoke [ChangeNotifier.mayBeDispatchObjectCreation]
in constructor of the class. It will help
to identify the owner in case of leaks.

### 2. Static or global object causes notGCed leaks

If you see notGCed leaks, where the retaining path starts with global or static variable,
this means that some objects were disposed, but references to them were never released.
Expand Down