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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T13:18:15+00:00 2026-05-11T13:18:15+00:00

I’m testing the timing of an algorithm that does lots of recursive calls. My

  • 0

I’m testing the timing of an algorithm that does lots of recursive calls. My program dies at about 128k recursive calls, and this takes only .05 seconds. I’d like to allow more memory to have longer timings in my analysis. I’m running linux and using gcc. Is there a system call, or environment variable, or gcc flag, or wrapper, or something?

  • 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. 2026-05-11T13:18:16+00:00Added an answer on May 11, 2026 at 1:18 pm

    There is no stack size complier option for gcc under Linux. However this text discusses how to set the stack size on Linux. using the ulimit command.

    Edit: That link died in Dec 2023 so here are the contents, as retrieved by the Wayback Machine:

    Stack Overflow Problems

    This file gives some hints on addressing this problem on different platforms.

    Under Unix-like systems, programs may throw a "Segmentation Fault" error. This can be due to stack overflow, especially from recursive function calls or huge data sets. In our demo program "Pi" (see "$(CORE_PATH)/progs/pi"), we compute Pi to any number of desired bits or digits.

    Here are some test results on when stack overflows will occur on different platforms, using their default stack sizes.

    platform default size # bits # digits
    SunOS/Solaris 8172K bytes <=39875 <=12003 (Shared Version)
    Linux 8172K bytes <=62407 <=18786
    Windows 1024K bytes <=10581 <=3185 (Release Version)
    cygwin 2048K bytes <=3630 <=1092

    If we now change their stack size to their maximum, our Pi program can compute more bits.

    platform stack size # bits # digits
    SunOS/Solaris unlimited >=100,000 30102
    Linux 8172K bytes <=33,219,282 <=10,000,000(?)
    Windows 32768K bytes <=343077 <=12041

    How to change the default stack size on different platforms

    In general, under Unix-like platforms, the stack size is controlled by environment variable, not the program itself.
    So you cannot pass any flags to the compilers, like gcc, to setup stack size.
    Under Windows platforms, the stack size information is contained in the executable files. It can be set during compilation in Visual C++, but this is not available in gcc.
    Alternatively, Microsoft provides a program "editbin.exe" which can change the executable files directly. Here are more details:

    SunOS/Solaris:

    limit # shows the current stack size
    unlimit # changes the stack size to unlimited
    setenv STACKSIZE 32768 # limits the stack size to 32M bytes

    Linux:

    ulimit -a # shows the current stack size
    ulimit -s 32768 # sets the stack size to 32M bytes

    Windows (during compilation):

    1. Select "Project->Setting".
    2. Select "Link" page.
    3. Select "Category" to "Output".
    4. Type your preferred stack size in "Reserve:" field under "Stack allocations". eg, 32768 in decimal or 0x20000 in hexadecimal.

    Windows (to modify the executable file):

    There are two programs included in Microsoft Visual Studio, "dumpbin.exe" and "editbin.exe".
    Run dumpbin /headers executable_file and you can see the "size of stack reserve" information in "optional header values".
    Run editbin /STACK:size to change the default stack size.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
Does anyone know how can I replace this 2 symbol below from the string
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I've got a string that has curly quotes in it. I'd like to replace
I am reading a book about Javascript and jQuery and using one of the
I have this code to decode numeric html entities to the UTF8 equivalent character.

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.