Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

_CrtlsValidHeapPointer(pUserData)

Posted on 1998-04-02
7
Medium Priority
?
653 Views
Last Modified: 2013-11-20
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?
0
Comment
Question by:engllf
  • 5
  • 2
7 Comments
 

Author Comment

by:engllf
ID: 1317396
Edited text of question
0
 
LVL 7

Accepted Solution

by:
galkin earned 100 total points
ID: 1317397
Usually this debug aasertion occurs when you delete object that is embedded to another object, so its destructor is called twice. For instance if there is a a object of type CWnd embedded in other class and you try to call delete from this object's PostNcDestroy overrride
0
 

Author Comment

by:engllf
ID: 1317398
If i send out a Release version with this problem, what will be the consequenses? System crash?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:engllf
ID: 1317399
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 ...
0
 

Author Comment

by:engllf
ID: 1317400
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?
 
0
 
LVL 7

Expert Comment

by:galkin
ID: 1317401
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
0
 

Author Comment

by:engllf
ID: 1317402
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
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

783 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question