leak_tracker library

Classes

AutoSnapshottingConfig
Configures auto-snapshotting, based on the value of ProcessInfo.currentRss (dart:io).
ContextKeys
LeakProvider
LeakReport
Leak information, passed from application to DevTools and than extended by DevTools after deeper analysis.
Leaks
Detailed information about found leaks.
LeakSummary
Statistical information about found leaks.
LeakTrackingConfiguration
LeakTrackingTestConfig
Configuration for leak tracking in unit tests.
MemoryUsageEvent
A record of a memory usage event.
SnapshotEvent
A record of a taken snapshot.
StackTraceCollectionConfig
Configuration of stack trace collection.
UsageEventsConfig
Configures memory usage tracking.
UsageTrackingConfig
Configures memory usage tracking.

Enums

LeakType

Constants

isLeakFree → const Matcher
Checks if the leak collection is empty.

Properties

autoSnapshotter ↔ AutoSnapshotter?
getter/setter pair
timer Timer?
getter/setter pair
usageEventCreator ↔ UsageEventCreator?
getter/setter pair

Functions

checkLeaks() LeakSummary
Checks for leaks and outputs LeakSummary as configured.
collectLeaks() Leaks
Returns details of the leaks collected since last invocation.
disableLeakTracking() → void
Disables leak tracking for the application.
dispatchObjectCreated({required String library, required String className, required Object object, Map<String, dynamic>? context}) → void
Dispatches object creation to the leak tracker.
dispatchObjectDisposed({required Object object, Map<String, dynamic>? context}) → void
Dispatches object disposal to the leak tracker.
dispatchObjectEvent(Map<Object, Map<String, Object>> event) → void
Dispatches an object event to the leak tracker.
dispatchObjectTrace({required Object object, Map<String, dynamic>? context}) → void
Dispatches additional context information to the leak tracker.
enableLeakTracking({LeakTrackingConfiguration? config, bool resetIfAlreadyEnabled = false}) → void
Enables leak tracking for the application.
stopMemoryUsageTracking() → void
Stops memory usage tracking if it is started by trackMemoryUsage.
trackMemoryUsage(UsageTrackingConfig config) → void
Enables memory usage tracking, based on the value of ProcessInfo.currentRss (dart:io).
withLeakTracking(DartAsyncCallback callback, {bool shouldThrowOnLeaks = true, Duration? timeoutForFinalGarbageCollection, StackTraceCollectionConfig stackTraceCollectionConfig = const StackTraceCollectionConfig(), AsyncCodeRunner? asyncCodeRunner}) Future<Leaks>
Runs callback with memory leak detection.

Typedefs

AsyncCodeRunner = Future<void> Function(DartAsyncCallback )
DartAsyncCallback = Future<void> Function()
Asynchronous callback.
LeaksCallback = void Function(Leaks leaks)
Handler to collect leak information.
LeakSummaryCallback = void Function(LeakSummary)
Handler to collect leak summary.
SnapshotCallback = void Function(SnapshotEvent event)
A callback that is called when a snapshot is taken.
UsageCallback = void Function(MemoryUsageEvent event)
A callback that is called for memory usage event.

Exceptions / Errors

MemoryLeaksDetectedError