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 7531201
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:06:43+00:00 2026-05-30T05:06:43+00:00

I thought I’d never say this. I would like to make my machine run

  • 0

I thought I’d never say this. I would like to make my machine run super-slow.

Here’s the manner in which I’d like to do this:
I’d like to allocate a single large array in F# (Array.init). It should be so large that random accesses into the array should generate page faults. I have 4GB RAM, and running in 64-bit mode. When I allocate 2^29 4-byte integers, runtime throws an out of memory exception.

> Array.init (1 <<< 28) (fun i->i);;
val it : int [] =
  [|0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; 16; 17; 18; 19; 20;
    21; 22; 23; 24; 25; 26; 27; 28; 29; 30; 31; 32; 33; 34; 35; 36; 37; 38; 39;
    40; 41; 42; 43; 44; 45; 46; 47; 48; 49; 50; 51; 52; 53; 54; 55; 56; 57; 58;
    59; 60; 61; 62; 63; 64; 65; 66; 67; 68; 69; 70; 71; 72; 73; 74; 75; 76; 77;
    78; 79; 80; 81; 82; 83; 84; 85; 86; 87; 88; 89; 90; 91; 92; 93; 94; 95; 96;
    97; 98; 99; ...|]
> Array.init (1 <<< 29) (fun i->i);;
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
   at <StartupCode$FSI_0003>.$FSI_0003.main@()
Stopped due to error
> 
  • 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-05-30T05:06:44+00:00Added an answer on May 30, 2026 at 5:06 am

    The maximum size allowed by the Microsoft CLR for a single object is 2GB, regardless of whether you’re running on a 32-bit or 64-bit platform.

    You’re running up against this hard limit when you try to allocate the array of 2**29 integers. (The array’s data would be exactly 2GB, but objects also need a few extra bytes for housekeeping etc, pushing you over 2GB.)

    Try allocating a slightly smaller array to allow for those extra few bytes of overhead. I can’t remember exactly how much smaller it’d need to be — a few experiments with (2**29)-3 integers, (2**29)-4 integers, (2**29)-5 integers etc should tell you pretty quickly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I thought I'd offer this softball to whomever would like to hit it out
I thought expressions like this would cause Haskell to evaluate forever. But the behaviors
I thought this would be a relatively simple task with something like FMOD, but
Thought I would pose this to the StackOverflow crowd since I've run out of
Thought my range of search options would easily find this. I wish to combine
I thought this would be fairly easy, but I'm totally baffled. I want one
I thought I would rewrite this question (same iteration). The original was how to
Never thought I'd have this problem :) The following snippet of code works in
I thought this would be really easy but I can't find a simple solution,
I thought this would be a pretty common question to look for in Google

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.