Windows error on calling exit(0)

S

Siam

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
 
V

Victor Bazarov

Siam said:
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
 
S

Siam

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."
 
V

Victor Bazarov

Siam said:
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
 
K

Kevin Handy

Siam said:
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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top