One successful generation does not establish a local AI app's memory behaviour. A realistic session includes model loading, several requests, longer context, cancellation, document changes, and other applications using the same device.
Measure the lifecycle rather than reading one process number. Separate the application's working data, runtime allocations, native resources, and operating-system reporting limitations before calling a pattern a leak.
Record a reproducible memory experiment
Name hardware, operating system, app build, runtime, backend, model artefact, context settings, input size, and measurement tool. Capture a baseline before loading, after loading, during work, after completion, and after the defined release action.
Review current runtime documentation and the platform's official memory tools. Resource allocation and release semantics depend on the engine and backend, not just Flutter object reachability.
Exercise a fictional lesson-preparation session
Use a fixed authorised passage and generate several drafts under the same settings. Then repeat with a longer passage, cancel a request, switch documents, and close the feature. Record observations at the same milestones.
Check whether resource use stabilises, grows with retained context by design, or continues growing without a corresponding product need. Repeat after the intended model-release operation. No memory numbers or successful stability result are claimed here.
Keep output and quality checks alongside resource observations. Discarding conversation state may lower memory while changing the task. Compare equivalent behaviour before claiming an optimisation.
Investigate ownership before forcing cleanup
Look for retained sessions, pending callbacks, streams, native handles, document buffers, and cached generated content. Determine which component owns each and when it should end.
Do not assume every retained allocation is a defect or that one garbage-collection event proves native resources are released. Some runtimes cache work deliberately. The question is whether the behaviour fits the documented lifecycle and customer resource budget.
The tradeoff is warm readiness versus device headroom. Retaining a model may improve the next request's startup while competing with document processing and other apps. A release policy should follow measured use patterns and supported hardware.
The ChalkLens portfolio account supplies local inference context. This session is a proposed measurement plan and does not publish its memory profile or benchmark results.
Track whether document buffers and generated histories remain intentionally reachable after the feature closes.
Questions about repeated inference memory
Is growth after the first request always a leak?
No. Caches, context, and lazy allocation can explain some changes. Verify ownership, expected bounds, and repeated behaviour before concluding.
Does clearing a Dart variable release the model?
Not necessarily. Follow the runtime's explicit lifecycle and inspect native resources where relevant.
What should a review compare?
Compare milestone observations, equivalent task behaviour, context size, cancellation, and release effects. Bring traces to a local AI resource review.