Memory leak with several ANSI sequences #11424

Closed
opened 2026-01-31 02:47:15 +00:00 by claunia · 3 comments
Owner

Originally created by @ZEDCWT on GitHub (Nov 15, 2020).

Originally assigned to: @zadjii-msft on GitHub.

Environment

Windows build number: 10.0.19042.508
Windows Terminal version (if applicable): 1.5.3142.0

Any other software?
Node v15.2.0

Steps to reproduce

  • Save the following content in a file, say, name it with test.js
var readline = require('readline'),count = 0;
setInterval(() =>
{
	console.log(++count,new Date)
	readline.moveCursor(process.stdout,0,-1)
},10)
  • Open the cmd.exe in the terminal
  • Run the script saved above with path\to\node.exe path\to\test.js

Expected behavior

No significant memory increasing should be observed

Actual behavior

To compare with, another cmd.exe is also directly started by Win+R and run the same script.
Here is the initial memory usage
Initial memory usage
Also, reported by Process Explorer, the WS Private and Working Set are

WindowsTerminal.exe	36976 K	101816 K

Then, leave them run for hours, and here is the memory usage after the counter hit 400k+.
Memory usage after 400k+

Next, Ctrl+C to end both node processes, and wait for 5min.
Memory usage after node killed

WindowsTerminal.exe	96444 K	157840 K

It seems that it memory leaked.
And by roughly counting during the progress, the memory usage grow about 0.1 MB / 10 sec.

Originally created by @ZEDCWT on GitHub (Nov 15, 2020). Originally assigned to: @zadjii-msft on GitHub. <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment ```none Windows build number: 10.0.19042.508 Windows Terminal version (if applicable): 1.5.3142.0 Any other software? Node v15.2.0 ``` # Steps to reproduce <!-- A description of how to trigger this bug. --> + Save the following content in a file, say, name it with `test.js` ```js var readline = require('readline'),count = 0; setInterval(() => { console.log(++count,new Date) readline.moveCursor(process.stdout,0,-1) },10) ``` + Open the cmd.exe in the terminal + Run the script saved above with `path\to\node.exe path\to\test.js` # Expected behavior <!-- A description of what you're expecting, possibly containing screenshots or reference material. --> No significant memory increasing should be observed # Actual behavior <!-- What's actually happening? --> To compare with, another cmd.exe is also directly started by `Win+R` and run the same script. Here is the initial memory usage ![Initial memory usage](https://user-images.githubusercontent.com/7867810/99187506-f7703800-2791-11eb-90ca-ca0daf64e6bf.png) Also, reported by `Process Explorer`, the `WS Private` and `Working Set` are ``` WindowsTerminal.exe 36976 K 101816 K ``` Then, leave them run for hours, and here is the memory usage after the counter hit 400k+. ![Memory usage after 400k+](https://user-images.githubusercontent.com/7867810/99187576-5b92fc00-2792-11eb-8b2c-9f930be7f8a7.png) Next, `Ctrl+C` to end both node processes, and wait for 5min. ![Memory usage after node killed](https://user-images.githubusercontent.com/7867810/99187598-81200580-2792-11eb-865e-37f21c5f1a0e.png) ``` WindowsTerminal.exe 96444 K 157840 K ``` It seems that it memory leaked. And by roughly counting during the progress, the memory usage grow about 0.1 MB / 10 sec.
Author
Owner

@DHowett commented on GitHub (Nov 15, 2020):

Hmm, you're right. Interesting.

@DHowett commented on GitHub (Nov 15, 2020): Hmm, you're right. Interesting.
Author
Owner

@DHowett commented on GitHub (Nov 15, 2020):

Good catch!

@DHowett commented on GitHub (Nov 15, 2020): Good catch!
Author
Owner

@ghost commented on GitHub (Jan 28, 2021):

:tada:This issue was addressed in #8618, which has now been successfully released as Windows Terminal Preview v1.6.10272.0.🎉

Handy links:

@ghost commented on GitHub (Jan 28, 2021): :tada:This issue was addressed in #8618, which has now been successfully released as `Windows Terminal Preview v1.6.10272.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.6.10272.0) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#11424