Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. as soon as start program got error message - stack overflow

as soon as start program got error message - stack overflow

Scheduled Pinned Locked Moved C / C++ / MFC
data-structureshelpquestion
5 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mrby123
    wrote on last edited by
    #1

    As soon as start program, not operate on any array yet, got error message: Unhandled exception at 0x77c315de in blast_frag.exe: 0xC00000FD: Stack overflow. Please help why ? Thanks

    L J E 3 Replies Last reply
    0
    • M mrby123

      As soon as start program, not operate on any array yet, got error message: Unhandled exception at 0x77c315de in blast_frag.exe: 0xC00000FD: Stack overflow. Please help why ? Thanks

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      mrby123 wrote:

      Please help why ?

      Because you have a bug in your code.

      Veni, vidi, abiit domum

      C 1 Reply Last reply
      0
      • M mrby123

        As soon as start program, not operate on any array yet, got error message: Unhandled exception at 0x77c315de in blast_frag.exe: 0xC00000FD: Stack overflow. Please help why ? Thanks

        J Offline
        J Offline
        Jochen Arndt
        wrote on last edited by
        #3

        Typical sources for stack overflows are declaring large objects on the stack and recursive function calls:

        void some_func()
        {
        // May result in stack overflow if the sizes are close to the stack size
        int large_array[500000];
        CSomeLargeObject Obj;

        // Recursive function without stop condition
        some\_func();
        
        // Recursive call if some\_other\_func() calls some\_func()
        some\_other\_func();
        

        }

        Large objects on the stack should be avoided. Use dynamic memory allocation instead (new or malloc()). So check your code for the above conditions. To detect recursive calls, use the debugger and check the functions that are called for recursions.

        1 Reply Last reply
        0
        • L Lost User

          mrby123 wrote:

          Please help why ?

          Because you have a bug in your code.

          Veni, vidi, abiit domum

          C Offline
          C Offline
          CPallini
          wrote on last edited by
          #4

          :-D True.

          Veni, vidi, vici.

          1 Reply Last reply
          0
          • M mrby123

            As soon as start program, not operate on any array yet, got error message: Unhandled exception at 0x77c315de in blast_frag.exe: 0xC00000FD: Stack overflow. Please help why ? Thanks

            E Offline
            E Offline
            Erudite_Eric
            wrote on last edited by
            #5

            So stop using so much stack. Functions calling themselves endlessly is the usual cause. Dont do it.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups