Solved

_CrtlsValidHeapPointer(pUserData)

Posted on 1998-04-02
7
492 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 50 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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MFC Dialog 9 49
Show shut-down message as Windows 8 shuts down. 9 92
ORA-01403: no data found 43 101
sum67 challenge 35 102
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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…
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.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

831 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