1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-04 18:06:22 +03:00

0029412: Huge Memory leak since I upgraded to OC 6.9.0

Added non-regression test bugs vis bug29412
This commit is contained in:
abv 2018-03-15 10:39:55 +03:00 committed by bugmaster
parent b1f350a2e1
commit 9fb8f3f174
2 changed files with 74 additions and 0 deletions

View File

@ -5333,6 +5333,52 @@ static Standard_Integer OCC28310 (Draw_Interpretor& /*theDI*/, Standard_Integer
return 0;
}
// repetitive display and removal of multiple small objects in the viewer for
// test of memory leak in visualization (OCCT 6.9.0 - 7.0.0)
static Standard_Integer OCC29412 (Draw_Interpretor& /*theDI*/, Standard_Integer theArgNb, const char** theArgVec)
{
Handle(AIS_InteractiveContext) aCtx = ViewerTest::GetAISContext();
if (aCtx.IsNull())
{
std::cout << "Error: no active view.\n";
return 1;
}
const int aNbIters = (theArgNb <= 1 ? 10000 : Draw::Atoi (theArgVec[1]));
int aProgressPrev = -1;
for (int m_loopIndex = 0; m_loopIndex < aNbIters; m_loopIndex++)
{
gp_Pnt pos;
gp_Vec dir(0, 0,1);
gp_Ax2 center (pos, dir);
gp_Circ circle (center, 1);
Handle(AIS_Shape) feature;
BRepBuilderAPI_MakeEdge builder( circle );
if( builder.Error() == BRepBuilderAPI_EdgeDone )
{
TopoDS_Edge E1 = builder.Edge();
TopoDS_Shape W2 = BRepBuilderAPI_MakeWire(E1).Wire();
feature = new AIS_Shape(W2);
aCtx->Display (feature, true);
}
aCtx->CurrentViewer()->Update();
ViewerTest::CurrentView()->FitAll();
aCtx->Remove (feature, true);
const int aProgress = (m_loopIndex * 100) / aNbIters;
if (aProgress != aProgressPrev)
{
std::cerr << aProgress << "%\r";
aProgressPrev = aProgress;
}
}
return 0;
}
//========================================================================
//function : Commands_19
//purpose :
@ -5471,5 +5517,6 @@ void QABugs::Commands_19(Draw_Interpretor& theCommands) {
theCommands.Add("OCC28310",
"OCC28310: Tests validness of iterator in AIS_InteractiveContext after an removing object from it",
__FILE__, OCC28310, group);
theCommands.Add("OCC29412", "OCC29412 [nb cycles]: test display / remove of many small objects", __FILE__, OCC29412, group);
return;
}

27
tests/bugs/vis/bug29412 Normal file
View File

@ -0,0 +1,27 @@
puts "# ==================================================================="
puts "# 0029412: Huge Memory leak since I upgraded to OC 6.9.0"
puts "# ==================================================================="
puts ""
pload VISUALIZATION
vcaps -vsync 0
vinit View1
vglinfo
OCC29412 100 ;# just to initialize
meminfo
vmemgpu
set heap_before [meminfo heap]
OCC29412
set heap_after [meminfo heap]
meminfo
vmemgpu
# check that memory increase is moderate: can be up to 75 KiB on Debian;
# note that the leak in OCCT 6.9.0 - 7.0.0 was ~ 19 MiB
if { $heap_after - $heap_before > 100 * 1024 } {
puts "Error: memory leak of [expr ($heap_after - $heap_before) / 1024] KiB"
}