I have a few questions about memory management in OCCT.
I have read the documentation in:
and looked at the source code for the samples.
As I understand it, OCCT has Handles/smartpointers , to simplify memory management.
For instance in the sample program ImportExport, (in CImportExportDoc::OnFileImportStep() ) there is the line:
Handle(TopTools_HSequenceOfShape) aSeqOfShape = CImportExport::ReadSTEP();
This aSeqOfShape is not explicitly deleted anywhere, rather it has a reference count which is decremented when aSeqOfShape goes out of scope, causing aSeqOfShape and all its contents to be deleted.
Is this correct?
To use these handles, is it necessary to have the environment variable "MMGT_OPT=1 set?
Working with this "Handle(TopTools_HSequenceOfShape) aSeqOfShape" ,
When I do aSeqOfShape.Remove() (or Clear() ) does OCCT delete the object(s) removed from the TopTools_HSequenceOfShape?
What about TopTools_HSequenceOfShape's SetValue()?
If I do:
aSeqOfShape.SetValue(1, aShape); // where aShape is a TopoDS_Shape
Does the existing TopoDS_Shape at index 1 in the TopTools_HSequenceOfShape get deleted , and replace by aShape ?
I am also using a NCollection_DataMap, I have:
NCollection_DataMap<TopoDS_Shape, TopTools_HSequenceOfShape> m_Faces;
This is map , where the keys are TopoDS_Shape, and the values are a TopTools_HSequenceOfShape.
(I am using this to store the TopoDS_Faces of the TopoDS_Shape in TopTools_HSequenceOfShape).
If I do
Does this delete all the contents of m_Faces, i.e all the TopoDS_Shapes, and all the contents of all the TopTools_HSequenceOfShapes?
Thank you very much