Continuous saving to STEP file

I convert my model data to STEP file through STEPCAFControl_Writer. Here is code:

Handle(TDocStd_Document) aDoc;
Handle(XCAFApp_Application) anApp=XCAFApp_Application::GetApplication();
Handle(XCAFDoc_ShapeTool) myShapeTool=XCAFDoc_DocumentTool::ShapeTool(aDoc->Main());
Handle(XCAFDoc_ColorTool) myColors=XCAFDoc_DocumentTool::ColorTool(aDoc->Main());

for(Standard_Integer i=1; i TDF_Label aLabel = myShapeTool->NewShape();
myShapeTool->SetShape(aLabel, sequenceOfShapes.Value(i));

STEPCAFControl_Writer myWriter;
myWriter.Perform(aDoc, fname);

The problem is large allocating of memory (sample STEP output had about 120MB and memory during conversion was about 1.1GB). I would ask if it is possible to save the STEP file continually so that the memory was released during conversion. E.g. by this way: I have data divided to sequence of TopoDS_Compound. Would it be possible to write one compound, release its memory, write next compound, release its memory and so on?


Forum supervisor's picture

Dear csa,
Theoretically it could be possible,
but for sure not with the current API of the component.
To do it you should improve the component and
replace the OCCT memory manager by another.