How do i increase the size of the program stack?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • lianne.ribeiro@gmail.com

    How do i increase the size of the program stack?

    I am using Visual C++ 6 IDE,with 512MB RAM. I have coded a recursive
    function that has a correct end condition for recursion. There is no
    infinite recursion.

    For some input data,the recursive function gets called so many times
    that it causes a 'First-chance exception in a.exe: 0xC00000FD: Stack
    Overflow.'

    How do i increase the size of the program stack?
  • Ivan Vecerina

    #2
    Re: How do i increase the size of the program stack?

    <lianne.ribeiro @gmail.comwrote in message
    news:27a2f808-4e64-4a9d-a69a-3a86b54279f2@u1 0g2000prn.googl egroups.com...
    :I am using Visual C++ 6 IDE,with 512MB RAM. I have coded a recursive
    : function that has a correct end condition for recursion. There is no
    : infinite recursion.
    :
    : For some input data,the recursive function gets called so many times
    : that it causes a 'First-chance exception in a.exe: 0xC00000FD: Stack
    : Overflow.'
    :
    : How do i increase the size of the program stack?

    As already stated, stack size probably can be configured as
    a parameter to your linker.

    But I would like to add that, in production code, I usually avoid
    poorly bounded recursion (in practice, everything that may recurse
    for more than log(input size) .
    Even if there cannot be infinite recursion, it is not a good sign
    that you are hitting the default stack size limit of your platform.

    Maybe recursion depth can be reduced by altering or tuning the
    algorithm. If not, derecursifying the algorithm is advisable...

    Regards -Ivan
    --
    http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form
    Brainbench MVP for C++ <http://www.brainbench.com



    Comment

    • Anand Hariharan

      #3
      Re: How do i increase the size of the program stack?

      On Sat, 22 Mar 2008 05:08:09 -0700, lianne.ribeiro wrote:

      (...)
      How do i increase the size of the program stack?
      Do not multi-post. Your question was answered in comp.lang.c

      - Anand



      --
      ROT-13 email address to reply

      Comment

      • Jerry Coffin

        #4
        Re: How do i increase the size of the program stack?

        In article <27a2f808-4e64-4a9d-a69a-3a86b54279f2
        @u10g2000prn.go oglegroups.com> , lianne.ribeiro@ gmail.com says...
        I am using Visual C++ 6 IDE,with 512MB RAM. I have coded a recursive
        function that has a correct end condition for recursion. There is no
        infinite recursion.
        >
        For some input data,the recursive function gets called so many times
        that it causes a 'First-chance exception in a.exe: 0xC00000FD: Stack
        Overflow.'
        >
        How do i increase the size of the program stack?
        You might want to ask somewhere that this would be topical, such as
        comp.os.ms-windows.program mer.win32. When you do, I'd advise adding one
        more crucial bit of data: whether that exception is followed almost
        immediately by a _second_ chance exception of the same type.

        --
        Later,
        Jerry.

        The universe is a figment of its own imagination.

        Comment

        • Anand Hariharan

          #5
          Re: How do i increase the size of the program stack?

          On Sat, 22 Mar 2008 21:06:06 -0600, Jerry Coffin wrote:
          In article <27a2f808-4e64-4a9d-a69a-3a86b54279f2
          @u10g2000prn.go oglegroups.com> , lianne.ribeiro@ gmail.com says...
          (..)
          >>
          >How do i increase the size of the program stack?
          >
          You might want to ask somewhere that this would be topical, such as
          comp.os.ms-windows.program mer.win32. When you do, I'd advise adding one
          more crucial bit of data: whether that exception is followed almost
          immediately by a _second_ chance exception of the same type.
          >
          This is a multi-post, and despite being OT, the OP got an answer in
          c.l.c.

          - Anand

          --
          ROT-13 email address to reply

          Comment

          Working...