Chuyển đến nội dung chính

Bài đăng

Hiển thị các bài đăng có nhãn Memory

Finding a Flutter memory leak: the five objects that never get disposed

A memory leak in Flutter rarely announces itself. The app works, tests pass, and then somebody navigates between two screens forty times and the process is at 900 MB. On a mid-range Android device that ends as an out-of-memory kill, reported to you as “the app closed by itself” with no stack trace. Dart is garbage collected, so a leak here means exactly one thing: something still holds a reference to an object you are done with . The whole investigation is finding what that something is. The five patterns In practice, almost every leak I have chased in a Flutter app was one of these. 1. A controller that is never disposed. AnimationController , TextEditingController , ScrollController , TabController , PageController — every one of them holds listeners and, in the animation case, a ticker registered with the scheduler. class _EditorState extends State < Editor > with SingleTickerProviderStateMixin { late final _text = TextEditingController (); late final _a...

Finding a Flutter memory leak: the five objects that never get disposed

A memory leak in Flutter rarely announces itself. The app works, tests pass, and then somebody navigates between two screens forty times and the process is at 900 MB. On a mid-range Android device that ends as an out-of-memory kill, reported to you as “the app closed by itself” with no stack trace. Dart is garbage collected, so a leak here means exactly one thing: something still holds a reference to an object you are done with . The whole investigation is finding what that something is. The five patterns In practice, almost every leak I have chased in a Flutter app was one of these. 1. A controller that is never disposed. AnimationController , TextEditingController , ScrollController , TabController , PageController — every one of them holds listeners and, in the animation case, a ticker registered with the scheduler. class _EditorState extends State < Editor > with SingleTickerProviderStateMixin { late final _text = TextEditingController (); late final _a...

Agent memory: files, a vector store, or just a bigger context window

Someone asks how to give their agent memory, and the answers arrive as a shopping list: a vector database, a summarisation step, a bigger context window, maybe a knowledge graph if the conversation has gone on long enough. All of these are real mechanisms. None of them is an answer, because the question hasn’t been split yet. “Memory” names three unrelated problems. Recalling a fact the user stated — they deploy from main , they hate emoji in commit messages, their staging database is the one in eu-west-1 . Recalling a decision the agent made — in March it moved checkout state off Riverpod, and there was a reason. Recalling how a task is normally done — the release runbook, the five steps before opening a PR, the thing you always forget about code signing. These have different shapes. A fact is short, stable, and there is exactly one right answer. A decision is a small document with a date and a rationale, and its value is mostly in the rationale. A procedure is an ordered list th...