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. InitializeCriticalSection throws ... something ?

InitializeCriticalSection throws ... something ?

Scheduled Pinned Locked Moved C / C++ / MFC
performancequestion
7 Posts 4 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
    Mr Brainley
    wrote on last edited by
    #1

    In the MSDN-documentation for the InitializeCriticalSection-function it says :

    In low memory situations, InitializeCriticalSection can raise a STATUS_NO_MEMORY exception.

    Now, what exactly do i have to catch here ?! Couldn't find any hint anywhere.

    D M 2 Replies Last reply
    0
    • M Mr Brainley

      In the MSDN-documentation for the InitializeCriticalSection-function it says :

      In low memory situations, InitializeCriticalSection can raise a STATUS_NO_MEMORY exception.

      Now, what exactly do i have to catch here ?! Couldn't find any hint anywhere.

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Mr.Brainley wrote:

      Now, what exactly do i have to catch here ?!

      There's nothing to catch.


      "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

      "Judge not by the eye but by the heart." - Native American Proverb

      M 1 Reply Last reply
      0
      • D David Crow

        Mr.Brainley wrote:

        Now, what exactly do i have to catch here ?!

        There's nothing to catch.


        "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

        "Judge not by the eye but by the heart." - Native American Proverb

        M Offline
        M Offline
        Mr Brainley
        wrote on last edited by
        #3

        Ok, rephrasing the question : What should i do ? Current strategy : nothing. But what exactly happens in such a low memory situation ? Does it crash the program ?

        D 1 Reply Last reply
        0
        • M Mr Brainley

          Ok, rephrasing the question : What should i do ? Current strategy : nothing. But what exactly happens in such a low memory situation ? Does it crash the program ?

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          Mr.Brainley wrote:

          What should i do ?

          Based on what I read, nothing (can be done).


          "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

          "Judge not by the eye but by the heart." - Native American Proverb

          L 1 Reply Last reply
          0
          • D David Crow

            Mr.Brainley wrote:

            What should i do ?

            Based on what I read, nothing (can be done).


            "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

            "Judge not by the eye but by the heart." - Native American Proverb

            L Offline
            L Offline
            led mike
            wrote on last edited by
            #5

            DavidCrow wrote:

            nothing (can be done).

            you mean besides stopping an unhandled exception from closing your app?

            led mike

            D 1 Reply Last reply
            0
            • M Mr Brainley

              In the MSDN-documentation for the InitializeCriticalSection-function it says :

              In low memory situations, InitializeCriticalSection can raise a STATUS_NO_MEMORY exception.

              Now, what exactly do i have to catch here ?! Couldn't find any hint anywhere.

              M Offline
              M Offline
              Mark Salsbery
              wrote on last edited by
              #6

              Just a guess... __try { ::InitializeCriticalSection(...); } __except (GetExceptionCode() == STATUS_NO_MEMORY ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) { ...STATUS_NO_MEMORY exception }

              1 Reply Last reply
              0
              • L led mike

                DavidCrow wrote:

                nothing (can be done).

                you mean besides stopping an unhandled exception from closing your app?

                led mike

                D Offline
                D Offline
                David Crow
                wrote on last edited by
                #7

                led mike wrote:

                you mean besides stopping an unhandled exception from closing your app?

                Since the exception is not raised in an exception-safe manner, I'm not sure. Don't try and catch it is the only thing I know to do.


                "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

                "Judge not by the eye but by the heart." - Native American Proverb

                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