Memory leak #23524

Open
opened 2026-01-31 08:44:43 +00:00 by claunia · 8 comments
Owner

Originally created by @PetarPetrushev on GitHub (Aug 16, 2025).

Windows Terminal version

1.22.12111.0

Windows build number

10.0.26100.4946

Other Software

No response

Steps to reproduce

Enter curl https://s1.cubzyn.net/other/curl.me.php (which curls a large amount of binary to the terminal)
And now even if the user closes the terminal window even after the command finished the console window and PTY process uses many gigabytes of RAM and continues to use more until it crashes. I have attached the source code of the PHP script.

curl.me.php

Expected Behavior

Since binary is being sent to terminal some issues are expected such as bells, messed up terminal or messed up input. However not a large memory leak.

Actual Behavior

Terminal freezes when command finishes due to the memory leak and leaks gigabytes of memory in the PTY host process until it crashes.

Originally created by @PetarPetrushev on GitHub (Aug 16, 2025). ### Windows Terminal version 1.22.12111.0 ### Windows build number 10.0.26100.4946 ### Other Software _No response_ ### Steps to reproduce Enter **curl https://s1.cubzyn.net/other/curl.me.php** (which curls a large amount of binary to the terminal) And now even if the user closes the terminal window even after the command finished the console window and PTY process uses many gigabytes of RAM and continues to use more until it crashes. I have attached the source code of the PHP script. [curl.me.php](https://github.com/user-attachments/files/21806483/curl.me.php) ### Expected Behavior Since binary is being sent to terminal some issues are expected such as bells, messed up terminal or messed up input. However not a large memory leak. ### Actual Behavior Terminal freezes when command finishes due to the memory leak and leaks gigabytes of memory in the PTY host process until it crashes.
Author
Owner

@DHowett commented on GitHub (Aug 20, 2025):

So, there are a couple places where we cache in-progress VT sequences (SOS, APC, PM, DCS, and OSC); if you spam a bunch of random data you will eventually generate a control sequence introducer and cause us to start buffering...

But also,

... why?

@DHowett commented on GitHub (Aug 20, 2025): So, there are a couple places where we cache in-progress VT sequences (SOS, APC, PM, DCS, and OSC); if you spam a bunch of random data you _will_ eventually generate a control sequence introducer and cause us to start buffering... But also, ... why?
Author
Owner

@lhecker commented on GitHub (Oct 15, 2025):

I have tried this locally with and without the use of curl and could not observe a memory leak myself. Unassigning this issue until someone can reproduce and investigate this.

@lhecker commented on GitHub (Oct 15, 2025): I have tried this locally with and without the use of `curl` and could not observe a memory leak myself. Unassigning this issue until someone can reproduce and investigate this.
Author
Owner

@PetarPetrushev commented on GitHub (Oct 15, 2025):

Hi. I just retried this and did not experience the memory leak so I think it may have been patched by a different change.

@PetarPetrushev commented on GitHub (Oct 15, 2025): Hi. I just retried this and did not experience the memory leak so I think it may have been patched by a different change.
Author
Owner

@PetarPetrushev commented on GitHub (Oct 15, 2025):

Hi. After doing some more testing this is still and issue and you can reproduce it if you run the command a few more times as the PHP script randomizes the output. I had the issue happen to me after about 5 trys. Try it a few more times as it is random. When it happened this time it froze my PC and i had to reboot.

@PetarPetrushev commented on GitHub (Oct 15, 2025): Hi. After doing some more testing this is still and issue and you can reproduce it if you run the command a few more times as the PHP script randomizes the output. I had the issue happen to me after about 5 trys. Try it a few more times as it is random. When it happened this time it froze my PC and i had to reboot.
Author
Owner

@lhecker commented on GitHub (Oct 15, 2025):

I've tried it lots and lots of times now and couldn't get it to reproduce.

@lhecker commented on GitHub (Oct 15, 2025): I've tried it lots and lots of times now and couldn't get it to reproduce.
Author
Owner

@PetarPetrushev commented on GitHub (Oct 15, 2025):

I will test it on a new fresh installed VM to see if it occurs. I will attach a video if it.

@PetarPetrushev commented on GitHub (Oct 15, 2025): I will test it on a new fresh installed VM to see if it occurs. I will attach a video if it.
Author
Owner

@PetarPetrushev commented on GitHub (Oct 15, 2025):

Actualy im having some issues getting the VM to work however the issue still occurs for me. I am on windows [Version 10.0.26100.6899] terminal: 1.23.12811.0

@PetarPetrushev commented on GitHub (Oct 15, 2025): Actualy im having some issues getting the VM to work however the issue still occurs for me. I am on windows [Version 10.0.26100.6899] terminal: 1.23.12811.0
Author
Owner

@psnet commented on GitHub (Nov 7, 2025):

Hi. After doing some more testing this is still and issue and you can reproduce it if you run the command a few more times as the PHP script randomizes the output. I had the issue happen to me after about 5 trys. Try it a few more times as it is random. When it happened this time it froze my PC and i had to reboot.

I think for reproducible example you can pregenerate 10 files and curl these pregenerated files each. Find that one who do memory leak and update this issue with that uploaded STATIC file instead of .php file, so everyone can reproduce that case.

@psnet commented on GitHub (Nov 7, 2025): > Hi. After doing some more testing this is still and issue and you can reproduce it if you run the command a few more times as the PHP script randomizes the output. I had the issue happen to me after about 5 trys. Try it a few more times as it is random. When it happened this time it froze my PC and i had to reboot. I think for reproducible example you can **pregenerate** 10 files and `curl` these pregenerated files each. Find that **one** who do memory leak and update this issue with that **uploaded** **_STATIC_** file instead of `.php` file, so everyone can reproduce that case.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#23524