Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(liveslots): avoid slotToVal memory leak for watched promises (#10758
) Liveslots has a bug (#10757) which leaks slotToVal entries when a tracked Promise is still being held in virtual data (e.g. a merely-virtual MapStore) at the time it becomes settled. This is triggered by `watchPromise` because of the order in which we attach two handlers: one which notices the resolution and is inhibited from deleting the slotToVal entry, and a second which removes the Promise from the (virtual) `promiseRegistrations` collection (thus enabling the deletion). For any watched Promise that is resolved, we leave a `slotToVal` entry (with an empty WeakRef) in RAM until the end of the incarnation. This PR does not fix the underlying bug, but it rearranges the handler order to avoid triggering it. The attached unit test fails with the original handler order (`slotToVal.size` grows), and passes with the swapped order (`slotToVal.size` remains constant). closes #10756 refs #10706
- Loading branch information