For Programmers: Free Programming Magazines  


Home > Archive > VC Language > November 2005 > How will it new/allocate memory on windows2003 when a class have string-type members?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author How will it new/allocate memory on windows2003 when a class have string-type members?
zhengfish

2005-11-22, 4:01 am

HI,all
I have a class named CCC which have some members of std::string
type.
I declare a class pointer like this:
CCC* ccc = new CCC( xml_input );
then I send the ccc to another module within the process with
msg_queue.
then this lead to a error on windows 2003 platform, but it's works
well on Redhat Linux 9.0.
In addition, I find out the same binary execute file could work well on
windows XP, but It faild on my windows 2003.
I debug it, and It's assert when the object pointer ccc is released.

what's the reason???

the error info on windows as follows:
========================================
=======================
---------------------------
Microsoft Visual C++ Debug Library
---------------------------
Debug Assertion Failed!


Program: E:\works\server\debug\configer.exe
File: dbgheap.c
Line: 1132


Expression: _CrtIsValidHeapPointer(pUserData)


For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.


(Press Retry to debug the application)

========================================
=======================

zhengfish

2005-11-22, 4:01 am

I'll try to release the ccc by itself with release() member function:
cccc.release{ delete this }
There is the same result.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com