ngd
ngd copied to clipboard
Max call stack size exceeded
Describe the bug
Running on a large angular app causes the error RangeError: Maximum call stack size exceeded
during file generation.
To Reproduce
Steps to reproduce the behavior:
Sorry. Hard to provide any steps without just having a large app to test on, which I unfortunately cannot provide. Simply running ngd
with no args threw the error after several files initially parsed successfully.
Expected behavior Don't throw the error.
Screenshots
Desktop (please complete the following information):
- OS: Mac OS
- Browser: N/A
- Version: 2.1.0
I also get this error, a large Angular 15 application.
Angular: 15.2.10
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, platform-server, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1502.10
@angular-devkit/build-angular 15.2.10
@angular-devkit/core 15.2.5
@angular-devkit/schematics 15.2.10
@angular/cdk 15.2.9
@schematics/angular 15.2.10
ng-packagr 15.2.2
rxjs 7.8.1
typescript 4.9.5
It seems to fail on the tail end of the work, generating the dependencies.dot
. I'm running the command with npx -p @compodoc/ngd-cli ngd
and it fails there.
I went back a few versions, and I tried this with ngd version 1: npx -p angular2-dependencies-graph ngd
.
This is the result:
Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value 16777216, (2) compile with -s ALLOW_MEMORY_GROWTH=1 which adjusts the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0
Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value 16777216, (2) compile with -s ALLOW_MEMORY_GROWTH=1 which adjusts the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0
[11:38:25] abort("Cannot enlarge memory arrays. Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value 16777216, (2) compile with -s ALLOW_MEMORY_GROWTH=1 which adjusts the size at runtime but prevents some optimizations, (3) set Module.TOTAL_MEMORY to a higher value before the program runs, or if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 ") at Error
at jsStackTrace (/home/zlatko/.npm/_npx/eb92f0ded616406a/node_modules/viz.js/viz.js:5:20800)
at stackTrace (/home/zlatko/.npm/_npx/eb92f0ded616406a/node_modules/viz.js/viz.js:5:20983)
at abort (/home/zlatko/.npm/_npx/eb92f0ded616406a/node_modules/viz.js/viz.js:28:5424)
at abortOnCannotGrowMemory (/home/zlatko/.npm/_npx/eb92f0ded616406a/node_modules/viz.js/viz.js:5:21343)
at enlargeMemory (/home/zlatko/.npm/_npx/eb92f0ded616406a/node_modules/viz.js/viz.js:5:21788)
at Function.dynamicAlloc [as alloc] (/home/zlatko/.npm/_npx/eb92f0ded616406a/node_modules/viz.js/viz.js:5:6269)
at _sbrk (/home/zlatko/.npm/_npx/eb92f0ded616406a/node_modules/viz.js/viz.js:5:602676)
at N4 (/home/zlatko/.npm/_npx/eb92f0ded616406a/node_modules/viz.js/viz.js:21:7406)
at cK (/home/zlatko/.npm/_npx/eb92f0ded616406a/node_modules/viz.js/viz.js:13:185312)
at bK (/home/zlatko/.npm/_npx/eb92f0ded616406a/node_modules/viz.js/viz.js:13:185061)
If this abort() is unexpected, build with -s ASSERTIONS=1 which can give more information.
[11:38:25] done
(node:44859) V8: /home/zlatko/.npm/_npx/eb92f0ded616406a/node_modules/viz.js/viz.js:15 Invalid asm.js: Function use doesn't match definition
(Use `node --trace-warnings ...` to show where the warning was created)
Edit: after a quick digging into the details, it seems that vis.js has problems with "very large families" or something along the lines.
ngd -t json
works fine, the other formats all fail with the same error.