RouterExtensions memory footprint increases significantly compared to *ngIf, possible memory leak!
Issue Description
Here is a demo for reproduction https://github.com/palikollar/ns-routing-memory-leak
There are 4 routing types implemented there. Just comment out the type what you want to try out / reproduce.
-
"if routing" Just two WebView component with *ngIf. The memory increased there ~20mb after 20 mins.

-
back navigation Navigates to nested routes and then back(). The memory increased ~50mb after 20 minutes.

-
clear history navigation Navigates to nested routes with clearHistory option set to true. The memory increased ~60mb after 20 minutes.

-
Simple navigation We can ignore this case because this is the incorrect way of using mobile stack navigation.

Why does the RouterExtensions navigate increased the memory footprint significantly compared to the simple *ngIf?
You can find the result screenshots here: https://github.com/palikollar/ns-routing-memory-leak/tree/master/results
Reproduction
use the link demo
Relevant log output (if applicable)
No response
Environment
OS: Windows 10 10.0.19044 CPU: (4) x64 Intel(R) Core(TM) i5-4670 CPU @ 3.40GHz Shell: Not Found node: 16.15.1 npm: 8.11.0 nativescript: Not Found
android
java: 11.0.12 ndk: Not Found apis: 28, 31, 32, 33 build_tools: 28.0.0, 28.0.3, 30.0.3, 33.0.0 system_images:
- android-30 | Google APIs Intel x86 Atom
- android-31 | Google APIs Intel x86 Atom_64
ios
xcode: Not Found cocoapods: Not Found python: Not Found python3: Not Found ruby: Not Found platforms: Not Found
Dependencies
"dependencies": { "@angular/animations": "~14.1.0", "@angular/common": "~14.1.0", "@angular/compiler": "~14.1.0", "@angular/core": "~14.1.0", "@angular/forms": "~14.1.0", "@angular/platform-browser": "~14.1.0", "@angular/platform-browser-dynamic": "~14.1.0", "@angular/router": "~14.1.0", "@nativescript/angular": "^14.0.0", "@nativescript/core": "~8.2.0", "@nativescript/theme": "~3.0.2", "rxjs": "~7.5.0", "zone.js": "~0.11.5" }, "devDependencies": { "@angular-devkit/build-angular": "~14.1.0", "@angular/compiler-cli": "~14.1.0", "@nativescript/android": "8.2.4", "@nativescript/types": "~8.2.0", "@nativescript/webpack": "~5.0.6", "@ngtools/webpack": "~14.1.0", "typescript": "~4.7.0" }
Please accept these terms
- [X] I have searched the existing issues as well as StackOverflow and this has not been posted before
- [X] This is a bug report
- [X] I agree to follow this project's Code of Conduct
@NorbertOcskai thanks for the report, could you bump the following to next:
"@nativescript/core": "next", <-- this is the 8.3.2 target you can help confirm
Then ns clean .... Please let us know how it goes.
This was also just merged into next and if you ensured you had these changes could also help your case:
https://github.com/NativeScript/NativeScript/pull/9977
Confirmed fix in >=8.3.2