943,640 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 726
  • C++ RSS
May 17th, 2009
0

How to immediately terminate program in C++

Expand Post »
Hello!

When my program in C++ exits, it throws errors like:
EInvalidPinter with message 'Invalid Pointer operation' ...
and later:
EAccessViolation with mesage 'Access violation at address 00000010 ...
and finally:

Abonarmal Program Termination


I can't locate the code responsible for it ( I am using many libraries in my program). I think that it's coused by some destructor (or uncalled destructor).
It appers only when I exit the program, and does not affect program work.

Is there a way to immediately terminate the program (without errors), so the memory would have to be freed by operating system?
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
35nando is offline Offline
10 posts
since Dec 2008
May 17th, 2009
0

Re: How to immediately terminate program in C++

You really need to fix the problem instead of trying to hid it.Try commenting out large blocks of code until the program no longer produces those errors. That will narrow down your search for the problem.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,947 posts
since Aug 2005
May 17th, 2009
0

Re: How to immediately terminate program in C++

Are you sure that the best method to avoid a threat is to cry: "Keep out of my sight!"?
Reputation Points: 1234
Solved Threads: 347
Postaholic
ArkM is offline Offline
2,001 posts
since Jul 2008
May 17th, 2009
0

Re: How to immediately terminate program in C++

If the problem is indeed in a library and you not doing anything incorrectly, maybe try exit(0) (from stdlib) as the last line of the program? I don't know if that would help? It would be nice if you could kind of find where it happens though so you could report the problem to the mailing list/forum for that library.

Dave
Featured Poster
Reputation Points: 437
Solved Threads: 204
Posting Virtuoso
daviddoria is offline Offline
1,968 posts
since Feb 2008
May 18th, 2009
0

Re: How to immediately terminate program in C++

> It appers only when I exit the program, and does not affect program work.
You mean it doesn't affect it YET.

Memory corruption problems move around the code over time (as you continue to make changes to the code).

All of a sudden, you could find it happens at some much more obvious and inconvenient point in the code (say save file).

If your regular debugger isn't providing much help, then try WinDbg
http://www.microsoft.com/whdc/devtoo...g/default.mspx
Team Colleague
Reputation Points: 5862
Solved Threads: 950
Posting Sage
Salem is offline Offline
7,164 posts
since Dec 2005
May 18th, 2009
0

Re: How to immediately terminate program in C++

>>All of a sudden, you could find it happens at some much more obvious and
>>inconvenient point in the code (say save file).
Quote ...
Murphy's Law for Computer programming: A program with undefined behavior(or ill defined behavior) will continue to work in all debugging session and will halt when a extremely important transaction is going on (for example a billion dollar deal).
LoL, so true
Reputation Points: 1486
Solved Threads: 140
Practically a Posting Shark
siddhant3s is offline Offline
816 posts
since Oct 2007
May 18th, 2009
0

Re: How to immediately terminate program in C++

Quote ...
35nando:
When my program in C++ exits, it throws errors like:
EInvalidPinter with message 'Invalid Pointer operation' ...
and later:
EAccessViolation with mesage 'Access violation at address 00000010 ...
and finally:

Abonarmal Program Termination
If your program uses alloc() or the like or
whatever that allocates something to a pointer, and
doesn't use free() or the like, it results to "invalid pointer operation" and "violation at address 00000010".

Allocate to a pointer and deallocate it if unused.

If this is not the case, recheck your constructors with its destructors.
Reputation Points: 12
Solved Threads: 5
Light Poster
neigyl_noval is offline Offline
32 posts
since May 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: c++ server (corba communication)
Next Thread in C++ Forum Timeline: list file





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC