[@builder.io/react] Server-side memory leak in isolated-vm binding evaluator (gen1 SDK never received the #4210 fix)
Versions
@builder.io/react 3.2.12 (gen1) — with @builder.io/sdk 2.2.6, @builder.io/widgets isolated-vm 5.0.4 Next.js 15.5.9 (output: 'standalone', isolated-vm in serverExternalPackages), React 19.2.3 Node 22.22.3, pnpm Runtime: Kubernetes, long-lived SSR pods with a cgroup memory limit
Summary
Every {{binding}} evaluated during SSR runs inside a single ivm.Isolate created lazily in getIsolateContext() (packages/react/src/functions/string-to-function.ts) and stored on Builder.serverContext for the lifetime of the process. Compiled closures and ivm.Reference handles accumulate inside that isolate and are never disposed or released, so process RSS grows ~10–20 MB/hr with no plateau until the pod hits its cgroup limit and is OOM-killed. Because the growth is native/isolate memory rather than V8 main heap, --max-old-space-size never triggers and heap snapshots look clean.
This appears to be the same leak fixed in #4210 for the gen2 SDK (@builder.io/sdk-react ≥ 5.1.0), but the fix was never ported to @builder.io/react.
Affected code
packages/react/src/functions/string-to-function.ts — getIsolateContext() creates one isolate forever; ivm.References passed to evalClosureSync are never released. packages/react/src/functions/try-eval.ts — same pattern; new ivm.Reference(data || {}) is never released, pinning the data object in the main heap.
Reproduction
Any Next.js SSR app using @builder.io/react with content that contains bindings. Render a Builder-driven route continuously under load and watch process.memoryUsage().rss climb linearly while heapUsed stays flat.
Source: BuilderIO/builder