I have noticed a memory leak because of caching of element types in tryFixCtx function in fixContext.js file.
As I see, tryFixCtx caches in a Map all the types that it gets.
It continues forever even if the element of that type is unmounted long time ago.
This often leads to detached references to nodes and thus memory leak.
In our project it leads to 600 nodes added on each visit to a page. We don't event need to use keepAlive, on that page.
I already prepared a solution which you could consider. But sadly I cannot create Pull Request here, so sharing screenshots instead.
Step 1. Add weakMemoize funciton which is 99% copy of memoize, but using WeakMap instead.
Notice added try catch, it was needed because WeakMap cannot have symbols as their keys.
Step 2. Use weakMemoize function instead of memoize
Hi,
I have noticed a memory leak because of caching of element types in tryFixCtx function in fixContext.js file. As I see, tryFixCtx caches in a Map all the types that it gets. It continues forever even if the element of that type is unmounted long time ago. This often leads to detached references to nodes and thus memory leak. In our project it leads to 600 nodes added on each visit to a page. We don't event need to use keepAlive, on that page.
I already prepared a solution which you could consider. But sadly I cannot create Pull Request here, so sharing screenshots instead.
Step 1. Add weakMemoize funciton which is 99% copy of memoize, but using WeakMap instead. Notice added try catch, it was needed because WeakMap cannot have symbols as their keys.
Step 2. Use weakMemoize function instead of memoize