THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 20/12/2004 at 03:11, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 9
Platform: Windows ;
Language(s) : C++ ;
---------
Hello
Now I've got a problem in memory leaking! I tried to make an object using ***Command Plugin. It's working ,but in the debug window it shows memory leaking. So I tried to release the memory after using the BaseObject and String and Vectors ( which are allocated using Alloc or bNew).
But when I try to do that, Cinema4D crash at all and close down. Here is my code:
void dlgMyClass::MyObj1()
{
BaseDocument *doc = GetActiveDocument();
BaseObject *obj = doc->GetActiveObject();
if(obj==NULL)
{
MessageDialog("No Selected Object!");
return;
}
PointObject *pObj=ToPoint(obj);
LONG cnt = pObj->GetPointCount();
Vector *vObj=pObj->GetPoint();
BaseSelect *bs = pObj->GetPointS();
String *arrLocation1 =bNew String[cnt];
String *XLoc1=bNew String[cnt];
String *ZLoc1=bNew String[cnt];
String *arrNames1 = bNew String[j+1];//new(array, j+1);
BaseObject *ObjObj1 = BaseObject::Alloc(Ocube);
/****************************Here I use them***********************************************/
doc->Message(MSG_UPDATE);
EventAdd(EVENT_FORCEREDRAW);
MessageDialog("Releasing the memory!");
//Releasing the memory
BaseObject::Free(ObjObj1);
bDelete(arrLocation1);
bDelete(XLoc1);
bDelete(ZLoc1);
bDelete(arrNames1);
}
After the dialog box showing "Releasing the memory!" the program crash. Why? Did I choose the wrong plugin type? I look at the samples of Cinema4D and in their command plugins, I didn't find the creation of the objects.
Please, do a favour for me ... urgently.
I'm waiting ...
With respects,
ZawMinTun