Files
gerrit/java
Dave Borowitz a4747d57a8 Don't leak AccountConfig references into AccountState
In I9b99490 AccountState was changed to lazily load the project watches
and preferences by passing a lambda referring to the AccountConfig
instance. Unfortunately, AccountConfig holds a reference to an open
Repository instance. In an implementation that does not cache these
instances, they are potentially expensive to hold, whether in terms of
heap or open resources. Plus, they are never closed.

Remove the lazy loading and go back to storing the watches and
preferences directly. This may be suboptimal memory usage, but in
practice will not be as bad as the many MiB of retained heap per entry
we're observing on googlesource.com. We still keep the Supplier
arguments in the AccountState constructor, to keep this change as simple
as possible to fix a production issue; reverting I9b99490 causes many
conflicts.

If we want to lazily load these fields, we will need to come up with an
approach that reopens the repository on demand. Alternatively, if we
decide that lazy loading is not worth the effort, we should remove the
Suppliers from the AccountState interface.

Change-Id: Id020fd89727b0a3377a98cffe8bf2e9cc2731451
2018-02-13 19:08:24 +00:00
..