Skip to content

Compress-Archive uses excessive amount of memory for large archives #108

Open
@martinmine

Description

@martinmine

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions