rules_swc
rules_swc copied to clipboard
Bazel OOM when using swc rules for a large repo
I am trying to migrate a large code base to using swc transpiler and I keep getting
FATAL: bazel ran out of memory and crashed. Printing stack trace:
java.lang.OutOfMemoryError: Java heap space
The only difference I see in my config is the use of --enable_runfiles . I have looked into the code to
understand why this flag is needed and if it is possible to turn it off.
How much memory does the machine have to work with and how many typescript files do you have in your repository?
Using swc as the transpiler creates one target per typescript file which can make for a very large graph.
We have 32GB machine and a repository of 1200 typescript files.
I even configure the bazel to have more memory with --host_jvm_args=-Xmx16g and no luck.
I also noticed that --enable_runfiles is not not required.
I wonder if the use of rules_js contributed to the large amount of starlark heap used. The next release includes #57 which might help.
I think we need the profile from bazel. @ewianda if you're still able to repro after the next release here, would you mind following https://bazel.build/rules/performance#memory-profiling to get an output of bazel dump --rules and a prof.gz that we can inspect?
Sorry, @alexeagle and @gregmagolan I should have reported back earlier.
This error went away after we migrated from rules_nodejs to rules_js.
Awesome thank you for confirming!