Windows error on calling exit(0)

Discussion in 'C++' started by Siam, Aug 1, 2006.

  1. Siam

    Siam Guest

    Hi all,

    I have a big application that does all sorts of network and video
    processing related functions. On closing the program, Windows gives me
    the "This program has encountered an error and needs to close" (send
    error report..) error message. I've traced the error all the way to the
    exit(0) call at the end of the program. When would a call to exit(0)
    produce an error like this? I've tried to ensure I'm closing all
    network connections and files I've opened before exiting, but would
    this result in a problem like this on exit? Any ideas?

    Cheers,
    Siam
     
    Siam, Aug 1, 2006
    #1
    1. Advertising

  2. Siam wrote:
    > I have a big application that does all sorts of network and video
    > processing related functions. On closing the program, Windows gives me
    > the "This program has encountered an error and needs to close" (send
    > error report..) error message. I've traced the error all the way to
    > the exit(0) call at the end of the program. When would a call to
    > exit(0) produce an error like this? I've tried to ensure I'm closing
    > all network connections and files I've opened before exiting, but
    > would this result in a problem like this on exit? Any ideas?


    AFAIK, no, 'exit' in itself isn't harmful, but the OS can do anything it
    wants, of course, and to find out what it does you need to post to the
    newsgroup dedicated to it.

    Also consdier that 'exit' is supposed to do some cleanup. If you have
    static objects created, it should try destructing those - if they are in
    some way invalid, it can cause undefined behaviour.

    V
    --
    Please remove capital 'A's when replying by e-mail
    I do not respond to top-posted replies, please don't ask
     
    Victor Bazarov, Aug 1, 2006
    #2
    1. Advertising

  3. Siam

    Siam Guest

    One more bit of information.... When i click the 'debug' button on the
    windows error dialog, it takes me to visual studio, that reports an
    "Unhandled exception in launch.exe (NTDLL.DLL): 0xC000005: Access
    Violation."
     
    Siam, Aug 1, 2006
    #3
  4. Siam wrote:
    > One more bit of information.... When i click the 'debug' button on the
    > windows error dialog, it takes me to visual studio, that reports an
    > "Unhandled exception in launch.exe (NTDLL.DLL): 0xC000005: Access
    > Violation."


    :-/ [speaking in terms of comp.lang.c++] I have no idea what it means,
    ask in a Visual C++ newsgroup. See the microsoft.public.vc.* hierarchy.

    V
    --
    Please remove capital 'A's when replying by e-mail
    I do not respond to top-posted replies, please don't ask
     
    Victor Bazarov, Aug 1, 2006
    #4
  5. Siam

    Kevin Handy Guest

    Siam wrote:
    > Hi all,
    >
    > I have a big application that does all sorts of network and video
    > processing related functions. On closing the program, Windows gives me
    > the "This program has encountered an error and needs to close" (send
    > error report..) error message. I've traced the error all the way to the
    > exit(0) call at the end of the program. When would a call to exit(0)
    > produce an error like this? I've tried to ensure I'm closing all
    > network connections and files I've opened before exiting, but would
    > this result in a problem like this on exit? Any ideas?


    Frequently this sort of thing is caused by memory corruption.
    This is of the "writing to unallocated memory", "writing past
    array bounds", "writing to freed memory", etc.
    The corruption occurred earlier, but is only noticed when
    the program is trying to clean up and exit.

    ----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
    http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
    ----= East and West-Coast Server Farms - Total Privacy via Encryption =----
     
    Kevin Handy, Aug 2, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?U2FuZHk=?=

    Code to Exit Web App and Exit Internet Explorer

    =?Utf-8?B?U2FuZHk=?=, Aug 3, 2005, in forum: ASP .Net
    Replies:
    7
    Views:
    7,905
    =?Utf-8?B?U2FuZHk=?=
    Aug 5, 2005
  2. Joe Smith
    Replies:
    4
    Views:
    65,867
    sandeep1976
    Nov 8, 2006
  3. Replies:
    2
    Views:
    459
    Jeff Epler
    May 31, 2005
  4. QQ
    Replies:
    5
    Views:
    522
    Jonathan Adams
    May 10, 2005
  5. Vicky

    Difference between exit(0) & exit (1)

    Vicky, Aug 8, 2006, in forum: C Programming
    Replies:
    6
    Views:
    709
    Kenneth Brody
    Aug 8, 2006
Loading...

Share This Page