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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:56:55+00:00 2026-06-01T16:56:55+00:00

I know that the amount of memory that compiler gives for creating an array

  • 0

I know that the amount of memory that compiler gives for creating an array has limits. How can I configure my compiler to increasing this memory. And if it is possible, what are the advantage and disadvantages?
I use linux and g++ compiler.

  • 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-01T16:56:56+00:00Added an answer on June 1, 2026 at 4:56 pm

    If you are talking about the stack size, it depends on the System you are using. Since you said to be on linux you can change the stack size from your program. However beware that this is not portable to other OS. To change the stack size you can use this function (More or less copyied from here)

    #include <sys/resource.h>
    
    using namespace std;
    
    //Increases the Stacksize to at least minStackSize
    bool setStack(rlim_t minStackSize)
    {
        struct rlimit rl;
        int result; 
    
        result = getrlimit(RLIMIT_STACK, &rl);
    
        //If we got an answer
        if (result == 0)
        {
            //Check if Stack is smaller than needed
            if (rl.rlim_cur < minStackSize)
            {
                //Increase Stacksize
                rl.rlim_cur = minStackSize;
                result = setrlimit(RLIMIT_STACK, &rl);
    
                if (result == 0)
                    return true;
                else
                    return false;
            }
            else
                return true;
        }
        else
            return false; 
    } 
    

    Note it is a minimalistic function and you probably want to add your own error messages, instead of just returnen TRUE/FALSE.

    The advantage of incresing your stack size, is simply that your programm does not crash if you try to put more variables on the stack than your stack size allows. The disadvantage is that this space is always occupied by your program regardless if it is actually used or not. (Your OS however can trick a bit)

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

Sidebar

Related Questions

I know that I can do something like $int = (int)99; //(int) has a
Is it possible to monitor the amount of memory that is in use or
We all know that CSS sprite images are great to reduce the amount of
I know that you can insert multiple rows at once, is there a way
I know that the MsNLB can be configured to user mulitcast with IGMP. However,
I have some code that prints the amount of memory used by the program.
There are many fields in /proc/mem: I know that I can't just take MemFree,
I know that you have to do it like this: int * p; p
I'd like to know the total amount of memory allocated while a method runs.
How do you know if your compiled SWF file has a memory leak? Are

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.