Saravana Muthu

HI ALL,

I got an error as follow when i am executing the code;
Debug Assertion failed
Program: my.exe
File: dbgheap.c
Line: 1011
Expression: _CrtIsValidHelpPointer(pUserData)
Even after i freed the memory allocated.

How to avoid this problem

Regards,
Saravana Muthu.G


Re: Visual C++ Language Memory leak

Pintu Shukla


I Am sure this Problem Occur in your code due to some unhandled memory or memory leak. just check out your code once again or if possible show your code here so anyone can help you.
Thanx





Re: Visual C++ Language Memory leak

Ramkrishna Pawar

Look at the call stack, which of your written function do you see Try posting more information such as code around assert failure line, call stack etc.






Re: Visual C++ Language Memory leak

einaros

It looks to me like you're trying to use a pointer that has been deallocated. Don't do that. Also, whenever possible, stick with smart pointers such as std::auto_ptr, boost:Tongue Tiedhared_ptr and so forth.





Re: Visual C++ Language Memory leak

Ramkrishna Pawar

einaros wrote:
It looks to me like you're trying to use a pointer that has been deallocated. Don't do that. Also, whenever possible, stick with smart pointers such as std::auto_ptr, boost:hared_ptr and so forth.

This could also be a case of deleting a corrupted memory block, or already deleted pointer.






Re: Visual C++ Language Memory leak

einaros

Ramkrishna Pawar wrote:

einaros wrote:
It looks to me like you're trying to use a pointer that has been deallocated. Don't do that. Also, whenever possible, stick with smart pointers such as std::auto_ptr, boost:hared_ptr and so forth.

This could also be a case of deleting a corrupted memory block, or already deleted pointer.



Both of which would fall into the "use a pointer that has been deallocated" category Smile





Re: Visual C++ Language Memory leak

Ramkrishna Pawar

einaros wrote:

...

Both of which would fall into the "use a pointer that has been deallocated" category Smile

Well, one could get assertion failure of same kind while trying to delete (even for first time) the pointer if the memory (heap) is corrupted, in such a case the pointer is not yet deallocated.