Estimate OCAF file size before saving

Hello.

I have asked already the same question on the user forum, but unfortunately, nobody react on it.

The question relates to OCC 6.8.0

Does somebody know, if there is a way to estimate the possible size of OCAF file having TDocStd_Document object without saving it? Any suggestions and tricks are welcome.

Thank you!

Sergey Slyadnev's picture

From my experience the amount of memory really depends on how you've chosen to keep your data in the Document. E.g. if you choose to store a point cloud (for example) as a single array (TDataStd_RealArray), then there is practically no overhead caused by OCAF. But if you put each point (as X, Y, Z triple) in an individual Label, then... that's a bad idea.

I never tried to estimate OCAF size before saving, but I would start with analysis of the transient (RAM) structure: to check the number of attributes, their lengths (if arrays) and so on. To get a better idea on the internal structure, I would dump my OCAF document to a text file to see all Labels and Attributes. Iterating the full OCAF structure with TDF_LabelIterator and estimating size of each attribute may give an idea of occupied memory in RAM. Then the file size will depend on the file format: XML or binary. And here probably some heuristic factor can be applied.