[vtkusers] _CrtIsValidHeapPointer(pUserData)problem with vtkdll.dll

Carsten Kübler kuebler at ira.uka.de
Mon Aug 13 09:03:13 EDT 2001


Hej,

a few days ago I suggested a problem with M$ Windows and vtk (as dll)
(running into problems....QT VTK DLL). Now a few days later, I have a
comparable problem. The programm failed because of:

Debug Assertion Failed!
File: dbgheap.c
Line: 1044
Expression: _CrtIsValidHeapPointer(pUserData)

I would appreciate that this problem occures frequently, but I found
nothing in the mailarchive. The only way to solve this problem is, to
change the concept of vtk - all objects had to delete their allocated
memory (now it's distributed in the source).

The actual problem occures in our new class for multitexture support (we
use code from vtkopengltexture's Load() method). Trace the assigned
memory of the resultData variable....

Thanks to the existence of vtkCharArray I was able to write a class for
both problems


class vtkMemoryKruecke : private vtkCharArray
{
public:
 ...
 char *NewMemory(int size);
 void DeleteMemory(char *ptr);
...
}

// allocate memory out of the vtkdll.dll
char *vtkMemoryKruecke::NewMemory(int size)
{
 this->SaveUserArray=true;
 this->Allocate(size,0);
 char*tmp=this->Array;
 this->Array= NULL;
 this->Size=0;
 return tmp;
};

// delete memory in the vtkdll.dll
void vtkMemoryKruecke::DeleteMemory(char *ptr)
{
 this->SaveUserArray=false;
 this->Array=ptr;
 this->Initialize();
}

I think it's a diry hack, but I don't know how to solve the problem on a
better way.

Carsten
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kuebler.vcf
Type: text/x-vcard
Size: 424 bytes
Desc: Card for Carsten Kübler
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20010813/85c120a6/attachment.vcf>


More information about the vtkusers mailing list