Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Program Crashes in NTDLL while exiting

Status
Not open for further replies.

evilpeer

Programmer
Sep 24, 2001
16
US
This particular program I'm working on uses CVI Labwindows for the user interfaces, while all of the code is written in MSVC++. The project is Modal Dialog based.

The program runs perfectly fine until it closes out. I've traced it, and in CRTEXE.C an exception is thrown. It then jumps into some files that I apparently don't have the source for, and eventually it crashes in NTDLL citing an access violation.

I really have no idea what might be causing this, and would appreciate any help you might be able to provide.
 
What is the message error you get (besides Access Violation?) Usually you are doing something wrong with the memory allocated for the process when that happens, it's not NTDLL's fault at all... [red]Nosferatu[/red]
We are what we eat...
There's no such thing as free meal...
once stated: methane@personal.ro
 
Look for bad buffer allocation/dealllocation in the code.

Something like:
chat x[]='exr';
strcat(x,'something');

Here the buffer increases and aat the end of the program/ function it resides in the dealocation of the stack memory will cause you an error.

I am almost sure that you have a problem of this type...

HTH, s-)

Blessed is he who in the name of justice and goodwill, sheperds the weak through the valley of darkness...
 
I removed all of the "#define new DEBUG_NEW" statements generated by MSVC++, since they had previously been giving me some problems with other classes (not sure why), and it has suddenly ceased crashing. I don't trust this lull though since it was having the same problem in release configuration earlier.

In case this problem comes back, would manually deallocating all memory relieve this problem? Would emptying be enough for a CString? Should I be suspect of delete statements in destructors?
 
I think you should always suspect not the new/delete on the heap but the deallocation on the stack, when at the end of the program/function 'the system' does the so called 'stack unwinding' calling the destructors for everything on the stack.

Also the 'stack unwinding' is done when an exception is thrown (no matter if you catch it or not)

HTH, s-)

Blessed is he who in the name of justice and goodwill, sheperds the weak through the valley of darkness...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top