-
Notifications
You must be signed in to change notification settings - Fork 27.1k
Description
Which @angular/* package(s) are the source of the bug?
platform-server
Is this a regression?
No
Description
ngModule version
I clone the Angular Universal repo version from angular:
- checkout master then:
pnpm install pnpm dev:ssrto servenodemon --inspect=localhost:9236 dist/server/main.jsto inspect
Then I start it and make a heap snapshot. it's fine.
Open dev tools for Node.js to inspect, Go to memory tab, search module keyword

first-time load home page:

load home page at second time:

everything is fine and no leak. NgModule only have 2 instance
Standalone version
I upgrade the universal version of the standalone component, I'm going to make this on the universal repo, but first, it has a memory leak.
- checkout master then:
pnpm install pnpm dev:ssrto servenodemon --inspect=localhost:9236 dist/server/main.jsto inspect
go home page and f5 for 6 times:

go home page and f5 for more 5 times:

we get too many modules that are not clear and the heap memory goes "To infinity and beyond".
The ApplicationModule goes to x6 on 6 load pages, and x11 if you have 11 load pages.
Please provide a link to a minimal reproduction of the bug
https://github.com/hiepxanh/universal-test
Please provide the exception or error you saw
No response
Please provide the environment you discovered this bug in (run ng version)
Angular CLI: 14.0.2
Node: 16.13.1
Package Manager: pnpm 7.1.5
OS: win32 x64
Angular: 14.0.3
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, platform-server
... router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1400.2
@angular-devkit/build-angular 14.0.2
@angular-devkit/core 14.0.2
@angular-devkit/schematics 14.0.2
@angular/cli 14.0.2
@nguniversal/builders 14.0.1
@nguniversal/common 14.0.1
@nguniversal/express-engine 14.0.1
@schematics/angular 14.0.2
rxjs 7.5.5
typescript 4.7.4
Anything else?
I'm running the standalone SSR version in my production version. Current work around is restart the server :D
