Memory leak with TopoDS_Shape

I've found that every time I set a TopoDS_Shape object to something new, the memory footprint increases. I've tried using operator delete, Nullify, and Standard::Purge, but they don't help at all. I'm using version 6.3. For example:

TopoDS_Shape aShape;

for(int i=0;i {
IGESControl_Reader aReader;


aShape.operator delete;

aShape = aReader.OneShape();

This will use 10 times as much memory as just defining aShape once.

Is there any way to prevent this leak, or are there any fixes for this issue?

Dmitry Khabi's picture

for StepReader you should call the function: reader.ClearShapes();
and for IGESControl_Reader ?

Compeau's picture

Nope, that doesn't work. For some reason during the line:

aShape = aReader.OneShape();

it is setting new memory for the new shape, without deleting the old.