Powershell: Memory leak while using pipeline

Created on 4 Jul 2020  路  3Comments  路  Source: PowerShell/PowerShell

Steps to reproduce

Compress a list of ~300 text files(~20M for each, in folder Data2020), using following command with pipeline in powershell core 7:

tar cvf - Data2020 | zstd - -o Data2020.tar.zst

Expected behavior

Compression stream won't consume too much memory, and the command should be fast.

After the failed try in ps core 7, I ran it again in cmd in cmder terminal or windows terminal. It actually ran well:

b

Memory usage kept around 50 MB.

Actual behavior

WhenI ran the command in windows terminal. After over 3 minutes, only about 60 files were compressed and memory usage

surged to over 5GB and still increased quickly. I close all the other apps but the command eat up even more memory and

didn't seem to finish, so I killed the process with ctrl + c. But memory usage didn't decline:

a

Environment data

PSVersion                      7.0.2
PSEdition                      Core
GitCommitId                    7.0.2
OS                             Microsoft Windows 10.0.19041
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0鈥
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0
Issue-Question Resolution-Duplicate

Most helpful comment

Hmm. Possibly related to https://github.com/PowerShell/PowerShell/issues/1908 I think?

All 3 comments

Hmm. Possibly related to https://github.com/PowerShell/PowerShell/issues/1908 I think?

You should use Start-Process to run this in native shell.

This issue has been marked as duplicate and has not had any activity for 1 day. It has been closed for housekeeping purposes.

Was this page helpful?
0 / 5 - 0 ratings