~/talk

Let’s Talk About Memory Leaks In Dart And Flutter

Talkat Flutter Connection 2024 · on Wednesday, 2024-04-24· [flutter, web-performance]
slides:none on file

Explains why Dart’s generational GC and mark‑and‑sweep leave objects reachable (for example passing a BuildContext into long‑lived callbacks or keeping static caches) and shows concrete fixes: cancel streams, detach listeners, limit caches, use weak references and Finalizer for native FFI cleanup, prefer BytesBuilder over repeated string concatenation, and add tests that run leak_tracker and export DevTools snapshots. Recommends static analysis and shows a project scan that finds 558 memory issues, plus using DevTools and Leak Tracker in CI.

AI-written summary · about

  1. 0:00Introduction and setup
  2. 3:06What to expect from this talk
  3. 4:10Memory leaks vs memory bloating
  4. 7:39Dart VM and garbage collection
  5. 11:36Disposable and risky objects
  6. 13:01Context references in closures
  7. 15:53Static variables and memory
  8. 17:18Weak references explained
  9. 19:27Weak maps and Finalizers
  10. 21:57Finalizer use cases
  11. 22:19Streams and listeners
  12. 23:26Widget lifecycle cleanup
  13. 24:31String concatenation optimization
  14. 25:57Lazy builders and memory
  15. 26:59Tooling for memory leaks
  16. 29:06Static analysis and DCM
  17. 30:35Book promotion and closing
~/search
type to search 8,222 conferences, 162,397 speakers and 219,688 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.