-
-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory leak on Node v20 #229
Comments
I'm unable to reproduce this and the reproduction doesn't feel sufficient. Would like to see a better way to measure memory usage (e.g. via (Also, shouldn't the baseline be Node.js?) Closing this out as per the Issue guidelines for lack of reproduction. Happy to re-open when it's reproducible. |
Footnotes
|
Thanks for confirming, @LangLangBart!1 Footnotes
|
npx tsx <filename>
, on a script that waits for the user input
thanks
test setuptouch require.cjs
touch loader.mjs
cat << EOF > test.mjs
import { createInterface } from 'readline';
const rl = createInterface({
input: process.stdin,
output: process.stdout,
});
rl.question('Please enter your answer: ', () =>rl.close());
EOF node v20node --version
# v20.0.0
node --require ./require.cjs --loader ./loader.mjs test.mjs
# check memory % in a second terminal tab for node
while true; do ps -A -o %mem,comm | grep node; sleep 2; done
# 1.2 node
# 4.5 node
# 8.3 node
# 11.5 node node latest nightlycurl --silent --remote-name https://nodejs.org/download/nightly/v21.0.0-nightly202304287ae1360358/node-v21.0.0-nightly202304287ae1360358-darwin-x64.tar.gz
tar -xzf node-v21.0.0-nightly202304287ae1360358-darwin-x64.tar.gz
export PATH="$HOME/node-v21.0.0-nightly202304287ae1360358-darwin-x64/bin:$PATH"
node --version
# v21.0.0-nightly202304287ae1360358
node --require ./require.cjs --loader ./loader.mjs test.mjs
while true; do ps -A -o %mem,comm | grep node; sleep 2; done
# 0.5 node
# 0.5 node
# 0.5 node
# 0.5 node |
Thanks for the thorough investigation @LangLangBart Glad it's not an issue with tsx. But we should fix the nightly error:
|
😀
|
Hey there! I just wanted to let you know that this issue has been resolved in Node v20.1.0 🎉 |
Bug description
Issue: When running
npx tsx example.ts
, memory usage grows infinitely. It happens independently of the file extension (tested with.ts
,.js
,.mjs
).Expectation: Memory should be stable (~30 MB) while waiting for the user input.
Confirmation: For comparison, it doesn't happen when running
npx jiti example.ts
.Reproduction
Environment
Note: I haven't installed
tsx
globally, but the version running throughnpx
is the following:Can you work on a fix?
The text was updated successfully, but these errors were encountered: