Microsoft.PowerShell.Archive icon indicating copy to clipboard operation
Microsoft.PowerShell.Archive copied to clipboard

Compress-Archive uses excessive amount of memory for large archives

Open martinmine opened this issue 4 years ago • 2 comments

Steps to reproduce

Simply try and zip a large folder, for example:

$compress = @{
  Path = "C:\bigdirectory\"
  DestinationPath = "C:\archive.zip"
}
Compress-Archive @compress

Expected behavior

I expect to be able to backup my servers without excessive memory usage. There are alternative APIs through PowerShell, but they are very inconvenient to use compared to Compress-Archive

Actual behavior

Executing the commands results in excessive memory usage for large archives. In my case I have a ~1.2GB on disk ZIP file which PowerShell uses around 18GB of ram to compress.

Environment data

Name                           Value
----                           -----
PSVersion                      7.1.3
PSEdition                      Core
GitCommitId                    7.1.3
OS                             Microsoft Windows 10.0.14393
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

martinmine avatar Oct 25 '21 06:10 martinmine

Hello! Any updates on this?

yodasad avatar May 19 '23 05:05 yodasad

hi, this is still happening on 7.4.1

djgus avatar Jan 12 '24 21:01 djgus