これを試して:
$mem_stress = "a" * 200MB
編集: couが1つのチャンクにすべてのメモリを割り当てることができない場合は、配列に複数のチャンクを割り当ててみてください。
$mem_stress = @()
for ($i = 0; $i -lt ###; $i++) { $mem_stress += ("a" * 200MB) }
GCはこれに干渉しないようです(1 GBのRAMが割り当てられたVMでのクイックテストの結果):
PS C:\> $a = @()
PS C:\> $a += ("a" * 200MB)
PS C:\> $a += ("a" * 200MB)
PS C:\> $a += ("a" * 200MB)
PS C:\> $a += ("a" * 200MB)
The '*' operator failed: Exception of type 'System.OutOfMemoryException' was thrown..
At line:1 char:13
+ $a += ("a" * <<<< 200MB)
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : OperatorFailed