-
Notifications
You must be signed in to change notification settings - Fork 119
Reduce worker_manager memory allocation #4435
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
6833140
Reduce worker_manager memory allocation
tddang-linagora e6fdce1
fixup! Reduce worker_manager memory allocation
tddang-linagora 9943d45
fixup! Reduce worker_manager memory allocation
tddang-linagora 3237c91
Remove unused flutter_downloader and workmanager
tddang-linagora 7b3ad5c
fixup! Reduce worker_manager memory allocation
tddang-linagora 7efdc48
Add ADR-0079 Tmail memory allocation optimization
tddang-linagora d34bf17
fixup! Add ADR-0079 Tmail memory allocation optimization
tddang-linagora 368d6ce
fixup! Add ADR-0079 Tmail memory allocation optimization
tddang-linagora File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: linagora/tmail-flutter
Length of output: 8102
Non-web uploads ignore
cancelTokenin the isolate-backed request flow.The method accepts
cancelToken(line 46) and the web branch passes it to_dioClient.post()(line 189), but the non-web worker path does not. At line 110,_handleUploadAttachmentAction()callsdioClient.post()without a cancellation token. This allows callers to cancel uploads and update local state while the HTTP request continues in the worker isolate and completes on the server.Options: implement cancellation via a dedicated worker-cancel channel or fall back to the main isolate for cancellable uploads.
🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implement a dedicated worker-cancel channel is costly, and fall back to main isolate just for the cancel capability affect the main isolate performance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tddang-linagora, that's a fair trade-off given the substantial memory gains demonstrated in the profiling images (Android Dart/Flutter heap drops from ~375 MB to ~109 MB, iOS from ~297 MB to ~105 MB). Introducing cross-isolate cancellation plumbing or forcing the main isolate to handle uploads just to support cancellation would offset those wins.A minimal mitigation would be adding a short comment near the
executeWithPortcall so future maintainers understand the deliberate limitation:This keeps the code self-documenting without adding any runtime overhead. Up to you whether you want to add it.
✏️ Learnings added
🧠 Learnings used