Release unused memory in factories after certain operations
Versions tested: 3.36.3 on Ubuntu 20.04 and 3.37.90 (flatpak gitecb4ce0) on Ubuntu 18.04
Description: evolution-addressbook-factory memory increases by a constant amount upon closing and reopening Evolution client with Contacts tab open (though intermittently). I'm using GNOME System Monitor to check memory usage.
Testing with 3.37 In this case I'm using Evolution 3.37.90 via flatpak build. I've imported ~150,000 contacts via CardDAV, and initial memory use for evolution-addressbook-factory is 1.4 GiB. Upon closing and reopening Evolution with Contacts tab open, evolution-addressbook-factory memory grows to 2.8 GiB, and upon subsequent restarts: 4.1 GiB, 5.5 GiB, and 6.8 GiB (all multiples of approx 1.4 GiB). It does not happen every time, only intermittently.
Testing with 3.36 I've tested Evolution 3.36.3 on a fresh install of Ubuntu 20.04 in VirtualBox. I've added no email accounts. I've imported a vCard file containing 2000 contacts via File -> Import... After import, each time I restart Evolution with Contacts tab open, the memory usage of evolution-addressbook-factory grows by ~6.3 MiB each time: 14.4, 21.0, 27.4, 33.6, 40.0, 44.3, 44.4 MiB and stops increasing the next few times. A while later (~15 mins) I try again, and it increases to 50.7, 57.0, 63.3 MiB and stays at this for further restarts.
Rebooting and repeating the process results in memory usage of: 10.4, 17.0, 23.8, ... 46.1 MiB.
I'd also tested an earlier build last week (3.37.3) with an address book of a few thousand addresses, and recorded memory usage of 9, 37, 57, 77, 96 MiB.
It could indicate a possible memory leak. In the case of large address books, the increase is very noticeable (At the peak, memory usage for evolution + addressbook processes was 8.5 GiB).
If you need further information/logs, feel free to ask.