subhash_patil
July 20th, 2002, 08:09 AM
hi gurus,
I have a strange problem. I have a COM dll. This COM dll has settings as "Multithreaded" for release and "debug Multithreaded" for debug version. I have a test application which hosts this dll as an INPROC server. In the dll, i create a pointer to a class using new. I delete it immediately in the next line. Here, on delete, I get an assertion in _CrtIsValidHeapPointer()! which says that the memory address does not belong to local heap. If i am deleting immediately after new, why should this problem come?
e.g. The dll function looks like this.
STDMETHODIMP CData::Write(IStream *pStream)
{
// class defined in another lib statically linked to this dll.
CMyClass *pMyClass = new CMyClass;
delete pMyClass; // Assertion at this.
}
Interestingly, if i create a pointer to the same class using new in Test application and delete it , it works fine. So there seems some problem within the dll. Can anyone throw some light on this??
thanx in advance!
I have a strange problem. I have a COM dll. This COM dll has settings as "Multithreaded" for release and "debug Multithreaded" for debug version. I have a test application which hosts this dll as an INPROC server. In the dll, i create a pointer to a class using new. I delete it immediately in the next line. Here, on delete, I get an assertion in _CrtIsValidHeapPointer()! which says that the memory address does not belong to local heap. If i am deleting immediately after new, why should this problem come?
e.g. The dll function looks like this.
STDMETHODIMP CData::Write(IStream *pStream)
{
// class defined in another lib statically linked to this dll.
CMyClass *pMyClass = new CMyClass;
delete pMyClass; // Assertion at this.
}
Interestingly, if i create a pointer to the same class using new in Test application and delete it , it works fine. So there seems some problem within the dll. Can anyone throw some light on this??
thanx in advance!