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?

Recommended Answers

All 6 Replies

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.

Are you sure that the best method to avoid a threat is to cry: "Keep out of my sight!"?

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.