Link to home
Start Free TrialLog in
Avatar of engllf
engllf

asked on

_CrtlsValidHeapPointer(pUserData)

WinNT4 SP3, VC5,

During exiting of program give the below assertion error:
_CrtlsValidHeapPointer(pUserData).  Pressing the debug button brings me to DBGHeap.C.

        _ASSERTE(_CrtIsValidHeapPointer(pUserData));

When i debug from ExitInstance(), it leads me to the below in CRT0CAT.C

           if (__onexitbegin) {
                _PVFV * pfend = __onexitend;

                while ( --pfend >= __onexitbegin )
                /*
                 * if current table entry is non-NULL,
                 * call thru it.
                 */
                if ( *pfend != NULL )
                    (**pfend)(); // Assert error...
            }


What is cause of this problem?

I have exited the ExitInstance(), does that mean that all my view, doc, has been successfully deleted? There where does the bad pointer comes from?

However in Release mode, exiting doesn't give any problem.
Is there is time bomb on the Release version?
Avatar of engllf
engllf

ASKER

Edited text of question
ASKER CERTIFIED SOLUTION
Avatar of galkin
galkin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of engllf

ASKER

If i send out a Release version with this problem, what will be the consequenses? System crash?
Avatar of engllf

ASKER

What i have is just a SDI with 2 pane splitter wnd.  
Simply launch the application, do nothing, exit the application already gives this problem.  What a terrible headache ...
Avatar of engllf

ASKER

I have stripped my application to

BOOL CIPD_WINDDEApp::InitInstance()
{
 return FALSE; // immediate exit
}

Still give me the problem. Now where does the CWnd comes from?
 
I gave you only an exaple what could cause a problem. Anywhay this debug function is called when heap corruption occurs. If your application is not large could you send it to me so I will be able to review it. My E-mail: agalkin@matlensilver.com
Avatar of engllf

ASKER

Thanx galkin,
I manage to solve the problem.
I guess the bad pointer is some
char* i defined in the CWinApp class.
After moving them out of the CWinApp
and define them as global variables,
no more assert failure.

leow