Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8592465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:45:24+00:00 2026-06-11T23:45:24+00:00

I am trying do some testing that requires resources to be under pressure. I

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T23:45:25+00:00Added an answer on June 11, 2026 at 11:45 pm

    Try this:

    $mem_stress = "a" * 200MB
    

    Edit: If cou can’t allocate all memory in a single chunk, try allocating multiple chunks in an array:

    $mem_stress = @()
    for ($i = 0; $i -lt ###; $i++) { $mem_stress += ("a" * 200MB) }
    

    The GC doesn’t seem to interfere with this (results from a quick test in a VM with 1 GB RAM assigned):

    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
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm testing some methods that involve email, and am trying to use a mock
I have been trying to add columns to a table using some logic that
I am trying do some testing examples with Facebook and Flash (using the Adobe
I'm trying to do some testing and it requires the Windows system to be
I'm trying to do some unit testing on a project that unfortunately has high
I am trying to do some Cucumber testing like the following: Given I am
I am trying to implement some unit testing for an old framework. I am
I am trying to test passwords. I need to do some testing on the
All, I'm trying to do some unit testing in some archaic java code (no
I'm trying to create some tool for testing WCF services. I'm aware of such

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.