where is SetReentrant() ,IsReentrant()?

in the release note of occ's 6.2.1 it says those function are include in OCC. Memory leakage issues make me headache.Please kindly provide me a way to avoid memory leakage methods
thanks

Andrey Betenev's picture

The functions SetReentrant(), IsReentrant() are static methods of the class Standard and hence are defined in Standard.hxx. Please make sure that you use OCCT 6.2.1 and not 6.2.0 or earlier.

P.S. It is quite unlikely that these methods help against memory leaks. If you are debugging possible memory leaks, make sure to define environment variable MMGT_OPT to zero, just to avoid side effects from OCCT memory manager.

Win Than Aung's picture

where can i download OCCT 6.2.1 version? on this website they only have 6.2.0 if i'm not wrong

Win Than Aung's picture

also instead of setting MMGT_OPT =0 in the environment, can I use function to set that variable to zero in the code? like using Setreentrant(), are there any SetMMGT_OPT() function?Also how to deallocate object in OCC?is it the same as C++ like using delete object;? how you delete the objects in OCC? if i set MMGT_OPT =0, can i still use MMGT_Reentrant =1(multithreaded)?
thanks

Andrey Betenev's picture

> where can i download OCCT 6.2.1 version? on this website they only have 6.2.0 if i'm not wrong

OCCT 6.2.1 is maintenance release, see http://www.opencascade.org/support/alacarte/maintrel

> also instead of setting MMGT_OPT =0 in the environment, can I use function to set that variable to zero in the code? like using Setreentrant(), are there any SetMMGT_OPT() function?

No. This option affects also execution of C/C++ startup code, thus it must be set in environment before start of application that uses OCCT.

> Also how to deallocate object in OCC?is it the same as C++ like using delete object;? how you delete the objects in OCC?

Yes, C++ new and delete operators are used normally for OCCT objects

> if i set MMGT_OPT =0, can i still use MMGT_Reentrant =1(multithreaded)?

There is no need in that, since this option affects only OCCT optimised memory manager. If MMGT_OPT=0, standard C++ RTL memory manager is used, and it is reentrant.

Win Than Aung's picture

would you mind sending me the OCCT 6.2.1 version's Standard.hxx,.cxx and the associate dependent header files and cxx files to the following email cuz i'm not allowed to download the latest version. or do you use www.xdrive.com? if so, could you upload 6.2.1 version on that network drive?

Win Than Aung's picture

thank you for your reply
1)STEPCAFControl_Reader* reader=NULL;
2)Handle(XCAFDoc_ShapeTool) Assembly;

3)XCAFApp_Application::GetApplication()->NewDocument("MDTV-XCAF",Doc);
4)Handle(XCAFDoc_ShapeTool) Assembly = XCAFDoc_DocumentTool::ShapeTool(Doc->Main());

5)TopoDS_Shape theshape;
6)TDF_LabelSequence Lab_Shapes;

7)Assembly->GetFreeShapes(Lab_Shapes);

8)Handle(XCAFDoc_ColorTool) one_Colors = XCAFDoc_DocumentTool::ColorTool(Doc->Main());

9)Quantity_Color one_Color;
10)TDF_Label one_ColorLabel = Lab_Shapes.Value(1);
11)TopoDS_Shape cshape = Assembly->GetShape(one_ColorLabel);

12) if(one_Colors->GetColor(cshape,XCAFDoc_ColorGen,one_Color)||
one_Colors->GetColor(cshape,XCAFDoc_ColorSurf,one_Color)||
one_Colors->GetColor(cshape,XCAFDoc_ColorCurv,one_Color))

in the above code, i know whoever initialized with new can be deleted using "delete reader"
i don't know how to deallocate the memory for Assembly(line4)
,should i use delete also?cuz assembly is Handle(...).

also should i delete theshape(line5) cuz it will take meory space.
one last question, when we go out of the OCC's code, those allocated memory will be deleted automatically or we have to do it manually?
can you briefly tell me in the line 1-12, which one should be deleted using which methods to deallocate memory.(free memory)

Win Than Aung's picture

my email address is "wwinthan@purdue.edu" thanks