I am trying do some testing that requires resources to be under pressure. I was able to find out how maximize CPU Usage using PowerShell.
start-job -ScriptBlock{
$result = 1;
foreach ($number in 1..2147483647)
{
$result = $result * $number
}
}
Is there a way I can use PowerShell to do the same for maximizing memory usage?
Try this:
Edit: If cou can’t allocate all memory in a single chunk, try allocating multiple chunks in an array:
The GC doesn’t seem to interfere with this (results from a quick test in a VM with 1 GB RAM assigned):