We have an application with complex and lengthy view. A view have approximately 50 components with own services, subscriptions, behaviors. Component have own variables including Arrays and FormGroups.
Problem: After navigating back to View1(Component1) from View2(Component2), I still see data of View2(Component2) in chrome devtool in Memory tab, and everytime it increase 25 MB memory in snapshot.
Eg:
- First time snapshot of View1 --> 50 MB
- Navigate to View2. Navigate to View1 --> snapshot size is 75 MB
- Navigate to View2. Navigate to View1 --> snapshot size is 100 MB
Every time, when I navigate to View2, it increases loading time by 4-5 seconds. I am clearing all subscriptions of View2, but still after navigating View1, it is showing me all Arrays and FormGroups, View2 component, variables with data.
I am expecting View1 should have same size after navigating from View2.
I have created small application and result is same,
[![enter image description here][1]][1]
Is this expected behavior or I need to take some steps?
In actual application, I see below snapshot after navigating back to View1.
I can see all FormGroups, arrays of previous Views.