Skip to content

Commit

Permalink
Merge branch 'main' of github.com:dart-lang/leak_tracker into perf
Browse files Browse the repository at this point in the history
  • Loading branch information
polina-c committed Jan 24, 2024
2 parents ef50f1e + 15366f2 commit 01f2efd
Show file tree
Hide file tree
Showing 34 changed files with 480 additions and 370 deletions.
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"streetsidesoftware.code-spell-checker", //https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker
]
}
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

[![CI](https://github.com/dart-lang/leak_tracker/actions/workflows/ci.yaml/badge.svg)](https://github.com/dart-lang/leak_tracker/actions/workflows/ci.yaml)

# Memory Leak Tracker
# Memory leak_tracker

This is a framework for detecting memory issues in Dart and Flutter applications.

Expand All @@ -22,10 +22,8 @@ Ready for use:

Under construction:

- [Leak tracking concepts](doc/CONCEPTS.md)
- [Detect memory leaks](doc/DETECT.md)
- [Troubleshoot memory leaks](doc/TROUBLESHOOT.md)
- [Baseline memory](doc/BASELINE.md)
- [Memory leak tracking](doc/leak_tracking/OVERVIEW.md)
- [Memory baselining](doc/BASELINE.md)

## Roadmap

Expand All @@ -37,12 +35,12 @@ Help us to prioritize future work by upvoting and commenting [potential new feat

For general contributing information, see Dart-wide [CONTRIBUTING.md](https://github.com/dart-lang/.github/blob/main/CONTRIBUTING.md).

### How to upgrade Dart SDK
### How to roll the latest version of this package to the Dart SDK repo

To upgrade Dart SDK with new version of `memory_usage` update leak_tracker commit
hash for leak_tracker_rev in [Dart SDK DEPS](https://github.com/dart-lang/sdk/blob/main/DEPS).

### How to upgrade flutter_test
### How to roll the latest version of this package to Flutter

To upgrade versions of leak_tracker and/or leak_tracker_testing used by `testWidgets`:

Expand Down
2 changes: 1 addition & 1 deletion doc/BASELINE.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ because. The numbers can be used only as relative measure, when the only change
is the code.
All other parameters, like version of Dart/Flutter SDK, target platform, build mode, hardware,
should stay the same.
ß

## How to use it?

To take baseline of memory footprint for your `testWidgetsWithLeakTracking`, pass baselining configuration to the test. It is recommended
Expand Down
189 changes: 0 additions & 189 deletions doc/DETECT.md

This file was deleted.

20 changes: 17 additions & 3 deletions doc/CONCEPTS.md → doc/leak_tracking/CONCEPTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,27 @@ The text below is under construction.
# Understand Memory Leak Tracking Concepts

This page describes leak tracking concepts.
See other information on memory leaks [here](../README.md).
Read more about leak tracking in [overview](OVERVIEW.md).

Before reading about leak tracking, understand [Dart memory concepts](https://docs.flutter.dev/development/tools/devtools/memory#basic-memory-concepts).
Before reading about leak tracking concepts, understand [Dart memory concepts](https://docs.flutter.dev/development/tools/devtools/memory#basic-memory-concepts).

## Object types

### Instrumented disposables

An instrumented disposable is a [disposable](https://docs.flutter.dev/tools/devtools/memory#disposable-object)
class whose creation and disposal are instrumented for
tracking by tools like leak_tracker. The instrumentation is done by dispatching events directly
to the `LeakTracking` class, or by dispatching events to the `FlutterMemoryAllocations` class,
which is listened to by `LeakTracking`.

### Package disposables

All [disposable](https://docs.flutter.dev/tools/devtools/memory#disposable-object) objects defined in a package.

## Addressed leak types

The leak tracker catches leaks related to the timing of object disposal and garbage collection (GC). When memory is being managed properly, an object's disposal and GC should occur in quick succession. After disposal, an object should be garbage collected during the next GC cycle. The tool uses this assumption to catch cases that do not follow this pattern.
The leak_tracker catches leaks related to the timing of object disposal and garbage collection (GC). When memory is being managed properly, an object's disposal and GC should occur in quick succession. After disposal, an object should be garbage collected during the next GC cycle. The tool uses this assumption to catch cases that do not follow this pattern.

By monitoring disposal and GC events, the tool detects
the following types of leaks:
Expand Down
Loading

0 comments on commit 01f2efd

Please sign in to comment.