[PERF] mail: fix memory leak from running mail tests#5165
Merged
jeanschoenlaub merged 1 commit intoMay 15, 2026
Conversation
|
This PR targets the un-managed branch odoo-dev/odoo:master-owl3-migration, it needs to be retargeted before it can be merged. |
f3557d4 to
2e6ee4b
Compare
Author
|
For comparison, same suite in |
Before this commit, running the whole `@mail` HOOT tests suite leads to heavy memory leak. This happens for one main reason: internal effects in `@mail` are not properly disposed in-between tests. This includes `onChange` utility function, which internally uses `immediateEffect`. 1. `onChange` was returning a proxy, but this return value was never used. This commit now makes it return a function to dispose effects that are internally used. Some components that were using `onChange` now can properly dispose these effects on destroy 2. `onChange` and `Record.onChange` (= a version of `onChange` that follows the store's update cycle) made in store, services, and JS models had no dispose strategy. This commit now adds several functions for `register(Record)OnChange` and `runDisposeFn(s)`, so that all these dispose functions are executed in-between each test. Browser tab RAM of running whole `@mail test`: - before this commit: 2GB - after this commit: 250MB
2e6ee4b to
c566884
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Before this commit, running the whole
@mailHOOT tests suite leads to heavy memory leak.This happens for one main reason: internal effects in
@mailare not properly disposed in-between tests. This includesonChangeutility function, which internally usesimmediateEffect.onChangewas returning a proxy, but this return value was never used. This commit now makes it return a function to dispose effects that are internally used. Some components that were usingonChangenow can properly dispose these effects on destroyonChangeandRecord.onChange(= a version ofonChangethat follows the store's update cycle) made in store, services, and JS models had no dispose strategy. This commit now adds several functions forregister(Record)OnChangeandrunDisposeFn(s), so that all these dispose functions are executed in-between each test.Browser tab RAM of running whole
@mail test: