💻
How are you using Babel?
Programmatic API (babel.transform, babel.parse)
Input code
for (let i = 0; i < 1e7; i++) {
ast = babel.transformFromAstSync(ast, src, {
configFile: false,
ast: true,
}).ast;
}
For a complete reproduction, see https://github.com/JLHwung/babel-transform-from-ast-leak
Configuration file name
No response
Configuration
N.A.
Current and expected behavior
Current: The memory usage rises beyond 2GB
Expected: The memory usage should be stable during repetitive transformFromAstSync calls.
Environment
System:
OS: macOS 12.0.1
Binaries:
Node: 17.0.1 - /opt/homebrew/bin/node
Yarn: 1.22.17 - /opt/homebrew/bin/yarn
npm: 8.1.0 - /opt/homebrew/bin/npm
npmPackages:
@babel/core: ^7.16.0 => 7.16.0
Possible solution
No response
Additional context
Found this issue when running jest --detect-leaks in the Babel codebase.
transformFromAstAsync and transformFromAst are also affected.
When switching transformFromAstSync to transformSync, the memory leakage can not be reproduced.
💻
How are you using Babel?
Programmatic API (
babel.transform,babel.parse)Input code
For a complete reproduction, see https://github.com/JLHwung/babel-transform-from-ast-leak
Configuration file name
No response
Configuration
N.A.
Current and expected behavior
Current: The memory usage rises beyond 2GB
Expected: The memory usage should be stable during repetitive
transformFromAstSynccalls.Environment
System:
OS: macOS 12.0.1
Binaries:
Node: 17.0.1 - /opt/homebrew/bin/node
Yarn: 1.22.17 - /opt/homebrew/bin/yarn
npm: 8.1.0 - /opt/homebrew/bin/npm
npmPackages:
@babel/core: ^7.16.0 => 7.16.0
Possible solution
No response
Additional context
Found this issue when running
jest --detect-leaksin the Babel codebase.transformFromAstAsyncandtransformFromAstare also affected.When switching
transformFromAstSynctotransformSync, the memory leakage can not be reproduced.