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

  • Home
  • SEARCH
  • 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 6775619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:55:40+00:00 2026-05-26T15:55:40+00:00

I am interested to find out what is the memory limit for the automatic

  • 0

I am interested to find out what is the memory limit for the automatic and dynamically-allocated variables, so I tested things like that:

int main() {
    const int N = 1000000;
    int a[N];
    a[1] = 100;
}

I found the maximum N that would not incur a Segmentation fault is 2,600,000, about 10MB.

Then I tested dynamically allocated variables, like this:

int main() {
    const int N = 1000000;
    int* a = new int [N];
    delete[] a;
}

I found that maximum N that would not throw an exception is about 730,000,000, that’s about 3GB.

Now the question is, how is the 10MB limit (for automatic variables) and 3GB limit (for dynamically-allocated variables) determined. I assume it is related to my machine? Also, is there any way to increase the limit, in case I really need it?

  • 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-26T15:55:41+00:00Added an answer on May 26, 2026 at 3:55 pm

    The limit for automatic variables is the amount of memory allocated for the machine stack. 10MB is actually rather high; 1 or 2 MB is a more common default.

    Obviously, the 3GB is the OS limit — it’s roughly the size of the process space allowed by the OS to a program. It’ll vary widely by OS and hardware platform.

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

Sidebar

Related Questions

I am interested to find out if there are any good platforms that are
I'm interested to find out whether there are any standards or resources that you
I am very interested to find out how to keep php passwords secure. Main
I'd like to find out about the size of an array being allocated by
I'm interested to find out if there is a performance benefit to partitioning a
I am interested to find out what is the best/fastest (most efficient) way to
I am interested in where string literals get allocated/stored. I did find one intriguing
I'm interested to find out which ORM has best support for Postgres SQL database?
public static void main (String[] args) { System.out.println(factorial(5)); } public int factorial(int n) {
I'm curious to find out how the latest JVMs would handle garbage collecting memory

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.