You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replace purgeModule cache busting with vm based sandboxing
The template compiler contents have to be evaluated separately for each
addon in the build pipeline. If they are **not** the AST plugins from
one addon leak through to other addons (or the app).
This issue led us to attempt to purge the normal node require cache (the
`purgeModule` code). This works (and has been in use for quite a while)
but causes a non-trivial amount of memory overhead since each of the addons'
ends up with a separate template compiler. This prevents JIT'ing and it
causes the source code of the template compiler itself to be in memory
many many many times (non-trivially increasing memory pressure).
Migrating to `vm.Script` and sandboxed contexts (similar to what is done
in FastBoot) resolves both of those issues. The script itself is cached
and not reevaluated each time (removing the memory pressure issues) and
the JIT information of the script context is also shared.
Thanks to @krisselden for pointing out this improvement!
0 commit comments