odoo/odoo#204655

Created by fw-bot
Merged at 27636442f747d49261f503d306bbd0929b7c66c0

Statuses:

label
odoo-dev:saas-18.1-18.0-test-high-memory-aku-427273-fw
head
a9e1c900bf8413c52cb3639a620dd957185c283a
merged
7 months ago by Discuss, Alexandre Kühn (aku)
odoo/odoo
18.0 #204521
saas-18.1 #204655
saas-18.2 #204683
saas-18.3
saas-18.4
19.0
master #204720

[FW][FIX] mail,*: less memory restrained between HOOT suite tests

Before this commit, when running a HOOT test suite with a dependency on @mail, the memory snapshot at end of suite test was higher than expected.

Steps to reproduce:

  • run HOOT suite global_filter_editor.test.js with 51 tests
  • make a snapshot of memory after test => observe that there's thousands of RecordList objects kept in memory (8976) instead of a few hundreds (176)

These tests do not make use of any mail code, but the manifest has dependency on @mail thus it loads mail store. This test suite is a good candidate to show constant memory issue from discuss code: 51 tests each having 176 record lists result in 8976 record lists in total.

The JS records are expected to be garbage collected after each test, thanks to store not being accessible from components and services (app is unmounted at end of test).

However, Rtc.iceServers field was preventing this and leads to keeping store in memory. This is happening because the default value of this field is DEFAULT_ICE_SERVERS, which is defined on window object globally and is shared among all the different stores in the test suite. The field is computed too, so an internal onChange also contributed in keeping a reference to observing this shared object.

This commit fixes the issue by providing a deep copy of this global variable as the default value of iceServers, allowing proper gc of store between tests of the suite.

Forward-Port-Of: #204521