HomePhabricator

Eliminate some memory leaks affecting LQT->Flow:

Description

Eliminate some memory leaks affecting LQT->Flow:

  • LocalBufferedBagOStuff does not clear its in-process cache after commit, so have the importer use BufferedBagOStuff instead.

    The only downside is that it won't have reads cached in-process at all, but for the importer's usage pattern this downside seems unlikely to come up much.

    Also rename in container.php for clarity.
  • Call ManagerGroup->clear(), which clears all the ObjectManager-s, their mappers, and triggers onAfterClear.

    This requires being very careful to avoid inserting an object that is already in the database. See clearManagerGroup.
  • Change UserNameBatch to use MapCacheLRU and limit to 250 per wiki. This may not be strictly required for the importer's use case, since UserNameListener has a onAfterClear listener (which is triggered by ObjectManager->clear). However, there are other uses of UserNameBatch, and this adds an extra layer of protection.
  • Add some notes about other possible improvements that apparently wouldn't impact the importer, but might impact other code.
  • Some comment updates I noticed along the way.

Bug: T106614
Bug: T108601
Change-Id: I988dff81de9e32da1470a89cc7cc5dfc07ef82e8