Allocation Conflict Error

M

Majuer

Hi,
I have a class in one DLL. Something like this:
class CLASS1
{
MyData* pData;
CLASS1()
{
pData = NULL;
}
Load()
{
pData = new MyData;
}

~CLASS1()
{
if (pData)
pData = delete pData;
}
}
Then in another DLL.
I have
CLASS1 myClass;
myClass.Load();
....


For release build, in boundscheker, I got this error message at the
destructor of CLASS1 (pData = delete pData;)

Allocation Conflict: Attempting to call global_operator_delete on
pointer 0x322E5D8, that was allocated by HeapAlloc.

Why the "new" was using HeapAlloc while the "delete" use
"global_operator_delete"(defined in afx.inl)?

Thanks!
 
J

Jack Klein

Hi,
I have a class in one DLL. Something like this:
class CLASS1
{
MyData* pData;
CLASS1()
{
pData = NULL;
}
Load()
{
pData = new MyData;
}

~CLASS1()
{
if (pData)
pData = delete pData;
}
}
Then in another DLL.
I have
CLASS1 myClass;
myClass.Load();
...


For release build, in boundscheker, I got this error message at the
destructor of CLASS1 (pData = delete pData;)

Allocation Conflict: Attempting to call global_operator_delete on
pointer 0x322E5D8, that was allocated by HeapAlloc.

Why the "new" was using HeapAlloc while the "delete" use
"global_operator_delete"(defined in afx.inl)?

Thanks!

Ask in a Windows programming newsgroup. None of DLL, HeapAlloc, or
global_operator_delete are defined by C++, they are all Microsoft
specific.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,145
Messages
2,570,826
Members
47,372
Latest member
LucretiaFo

Latest Threads

Top