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?

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.

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

> 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/devtools/debugging/default.mspx

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

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

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.

This article has been dead for over six months. Start a new discussion instead.