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. Stack Overflow Exception

Stack Overflow Exception

Scheduled Pinned Locked Moved C / C++ / MFC
comdata-structuresperformancequestion
6 Posts 3 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.
  • A Offline
    A Offline
    AssemblySoft
    wrote on last edited by
    #1

    Hi I'm getting an unhandled exception in MSVCRTD.DLL Stack Overflow. Basically I can't see where it's coming from. The below try block call's itself recursively and doing some other stuff along the way until a global count has been reached. The only exception i can trap is the catch all. Is there anyway of determining the type of exception? I can't work out where it is being thrown from? :( code: try { AddNextCallToPlayList(); } catch( CMemoryException* e ) { LOG_ERROR(_T("CMem\n")); // Handle the out-of-memory exception here. } catch( CFileException* e ) { // Handle the file exceptions here. LOG_ERROR(_T("CFile\n")); } catch( CException* e ) { // Handle all other types of exceptions here. LOG_ERROR(_T("CException \n")); } catch(_com_error e) { LOG_ERROR(_T("catch com\n")); } catch(...) //__except(EXCEPTION_EXECUTE_HANDLER) { LOG_ERROR(_T("catch all\n")); }

    T 1 Reply Last reply
    0
    • A AssemblySoft

      Hi I'm getting an unhandled exception in MSVCRTD.DLL Stack Overflow. Basically I can't see where it's coming from. The below try block call's itself recursively and doing some other stuff along the way until a global count has been reached. The only exception i can trap is the catch all. Is there anyway of determining the type of exception? I can't work out where it is being thrown from? :( code: try { AddNextCallToPlayList(); } catch( CMemoryException* e ) { LOG_ERROR(_T("CMem\n")); // Handle the out-of-memory exception here. } catch( CFileException* e ) { // Handle the file exceptions here. LOG_ERROR(_T("CFile\n")); } catch( CException* e ) { // Handle all other types of exceptions here. LOG_ERROR(_T("CException \n")); } catch(_com_error e) { LOG_ERROR(_T("catch com\n")); } catch(...) //__except(EXCEPTION_EXECUTE_HANDLER) { LOG_ERROR(_T("catch all\n")); }

      T Offline
      T Offline
      Tim Smith
      wrote on last edited by
      #2

      Either remove the catchall or set stack overflow exceptions to break into the debugger. Then you can look at the call stack. Tim Smith I'm going to patent thought. I have yet to see any prior art.

      A 1 Reply Last reply
      0
      • T Tim Smith

        Either remove the catchall or set stack overflow exceptions to break into the debugger. Then you can look at the call stack. Tim Smith I'm going to patent thought. I have yet to see any prior art.

        A Offline
        A Offline
        AssemblySoft
        wrote on last edited by
        #3

        The problem is that it runs through this code at least 137 times without causing a problem. If i remove the catch all the stack is showing the current function but no where near anything that could cause a problem. How do i set set stack overflow exceptions? Your comments are appreciated Carl

        R 1 Reply Last reply
        0
        • A AssemblySoft

          The problem is that it runs through this code at least 137 times without causing a problem. If i remove the catch all the stack is showing the current function but no where near anything that could cause a problem. How do i set set stack overflow exceptions? Your comments are appreciated Carl

          R Offline
          R Offline
          Ryan Binns
          wrote on last edited by
          #4

          crandall wrote: The problem is that it runs through this code at least 137 times without causing a problem. It sounds like the stack overflow is being caused by unbounded recursion. Check to see if this function can be called recursively somehow, and if it is, make sure it doesn't get called too many times.

          Ryan

          "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

          A 1 Reply Last reply
          0
          • R Ryan Binns

            crandall wrote: The problem is that it runs through this code at least 137 times without causing a problem. It sounds like the stack overflow is being caused by unbounded recursion. Check to see if this function can be called recursively somehow, and if it is, make sure it doesn't get called too many times.

            Ryan

            "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

            A Offline
            A Offline
            AssemblySoft
            wrote on last edited by
            #5

            It is being called recursively. How can i achieve this successfully? Carl

            R 1 Reply Last reply
            0
            • A AssemblySoft

              It is being called recursively. How can i achieve this successfully? Carl

              R Offline
              R Offline
              Ryan Binns
              wrote on last edited by
              #6

              You need to include some code to prevent the recursion from going too deep; you need to reduce the number of times the function is called recursively. How you do this is up to you, but you may need to convert the algorithm to an iterative one. If you can limit the depth of the recursion without ruining the algorithm then that would be the best option.

              Ryan

              "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

              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