
Mon, 12/15/2008 - 08:44
Hello,
I wish to express my gratitude for OpenCASCADE developers.
I have a question about OpenCASCADE 6.3 usage.
I used OpenCASCADE as follows.
(1) Set AutoActivateSelection OFF.
myAISContext->SetAutoActivateSelection(Standard_False);
(2) Create 3D object.
gp_Pnt point(0.0, 0.0, 0.0);
gp_Dir direction(1.0, 0.0, 0.0);
TopoDS_Shape cone = BRepPrimAPI_MakeCone(gp_Ax2(point, direction), 50.0, 0.0, 50.0);
Handle(AIS_Shape) handle = new AIS_Shape(cone);
(3) Display 3D object with DisplayMode index 1.
myAISContext->SetDisplayMode(handle, 1, Standard_False);
myAISContext->Display(handle, Standard_True);
(4) Delete 3D object.
myAISContext->Remove(handle);
After (4), memory seems to be not released.
I repeated steps (2)-(4) many times, then memory usage was increasing and
finally, memory was insufficient.
Is a wrong usage done?
---------------------------------------------------------
//Test code.
---------------------------------------------------------
void test() {
myAISContext->SetAutoActivateSelection(Standard_False);
for (int j = 0; j gp_Pnt point(0.0, 0.0, 0.0);
gp_Dir direction(1.0, 0.0, 0.0);
TopoDS_Shape cone = BRepPrimAPI_MakeCone(gp_Ax2(point, direction), 50.0, 0.0, 50.0);
Handle(AIS_Shape) handle = new AIS_Shape(cone);
myAISContext->SetDisplayMode(handle, 1, Standard_False);
myAISContext->Display(handle, Standard_True);
myAISContext->Remove(handle);
}
}
---------------------------------------------------------
* If displayed with DisplayMode index 0, memory usage was not increasing.
myAISContext->SetDisplayMode(handle, 0, Standard_False);
* If set AutoActivateSelection ON, memory usage was increasing.
myAISContext->SetAutoActivateSelection(Standard_True);
(My Environment)
- OpenCASCADE 6.3
- Windows XP (SP2) / Visual Studio 2005
(Using Visual C++ 6.0, the same problem happened.)
Yokoyama
Mon, 12/15/2008 - 10:22
Have you tried to delete AIS_Shape instance?
myAISContext->Remove(handle);
handle=NULL;
Mon, 12/15/2008 - 12:42
Thank you for your advice!!
I had tried to delete AIS_Shape instance.
myAISContext->Remove(handle);
handle = NULL;
or
myAISContext->Remove(handle);
handle.Nullify();
But my problem could not be resolved.
Wed, 12/17/2008 - 10:24
Not at all;)
What is the diffent between
myAISContext->Remove(handle);
and
myAISContext->Clear(handle);
?
Fri, 12/19/2008 - 10:03
Thank you for your response. :-)
I have tried two methods.
(1) myAISContext->Remove(handle);
(2) myAISContext->Clear(handle);
But, the difference was not seen.
(Memory usage was not decreased.)
I read the comment in the header file "ais_interactivecontext.hxx",
and two methods seemed to be same.
Thu, 11/26/2020 - 12:20
Hi Yokoyama
I have the same problem ,have you solved the problem yet?
Greets,
Liao
Thu, 11/26/2020 - 12:42
This is a twelve-years-old topic!
If you experience a reproducible memory leak on up-to-date OCCT version (7.5.0), consider reporting an issue on Bugtracker with necessary details.
Check graphic driver updates as well, as displaying a model in 3D viewer involves OpenGL drivers, which may also contain memory usage bugs.