Prerequisites
Steps to reproduce
- Create the file
memoryleak.ps1 with the following content:
#Requires -Version 7
#Requires -Modules @{ ModuleName="Microsoft.Graph"; ModuleVersion="2.24.0" }
[CmdletBinding()]
param (
[Parameter()]
[switch]
$SayHello
)
if ($SayHello) {
"Hello!"
} else {
"I say nothing!"
}
- Install the dependency
Microsoft.Graph.
- Enter into the terminal:
memoryleak.ps1 -
- Press tab (for autocompletion).
Expected behavior
Autocompletion should find parameter `-SayHello'
Actual behavior
1. Autocompletion will not finish.
2. The current pwsh.exe process starts consuming more and more memory (over 2GB in my case).
Error details
Not available as process must be killed.
Environment data
Name Value
---- -----
PSVersion 7.4.6
PSEdition Core
GitCommitId 7.4.6
OS Microsoft Windows 10.0.26100
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visuals
The upper process is the relevant one:

Prerequisites
Steps to reproduce
memoryleak.ps1with the following content:Microsoft.Graph.memoryleak.ps1 -Expected behavior
Autocompletion should find parameter `-SayHello'Actual behavior
Error details
Not available as process must be killed.Environment data
Visuals
The upper process is the relevant one:
