From f391e9f2c520b78affcec2896eac206218113d41 Mon Sep 17 00:00:00 2001 From: "Pawel, DBV" <> Date: Fri, 17 Feb 2012 08:09:20 +0000 Subject: [PATCH] 0022936: Memory leak in inc\MAT_Mat.gxx line --- src/MAT/MAT_Mat.gxx | 51 ++++++++++++++++++--------------------------- 1 file changed, 20 insertions(+), 31 deletions(-) diff --git a/src/MAT/MAT_Mat.gxx b/src/MAT/MAT_Mat.gxx index 5f7a1e9474..4248b07a1b 100755 --- a/src/MAT/MAT_Mat.gxx +++ b/src/MAT/MAT_Mat.gxx @@ -146,14 +146,9 @@ void MAT_Mat::CreateMat(Tool& atool) toleranceofconfusion = atool.ToleranceOfConfusion(); NumberMaxOfIte = noofedges*noofedges; - Standard_Integer* firstarea = new Standard_Integer[noofedges]; - Standard_Integer* lastarea = new Standard_Integer[noofedges]; - Standard_Integer* noofarea = new Standard_Integer[noofedges]; - - if (noofarea == 0) { - cout <<" Erreur d allocation "<Index(); - lastarea[narea] = firstarea[narea]; - noofarea[narea] = 1; + firstarea(++narea) = theedgelist->Index(); + lastarea(narea) = firstarea(narea); + noofarea(narea) = 1; } else { - if(theedgelist->Index() == lastarea[narea]+1) { - lastarea[narea]++; - noofarea[narea]++; + if(theedgelist->Index() == lastarea(narea)+1) { + lastarea(narea)++; + noofarea(narea)++; } else { - firstarea[++narea] = theedgelist->Index(); - lastarea[narea] = firstarea[narea]; - noofarea[narea] = 1; + firstarea(++narea) = theedgelist->Index(); + lastarea(narea) = firstarea(narea); + noofarea(narea) = 1; } } } @@ -543,10 +538,10 @@ void MAT_Mat::CreateMat(Tool& atool) compact = 0; if(narea > 0) { - if(lastarea[narea] == theedgelist->Number() && firstarea[0] == 1) { - firstarea[0] = firstarea[narea]; - noofarea[0] = noofarea[0]+noofarea[narea]; - compact = noofarea[narea]; + if(lastarea(narea) == theedgelist->Number() && firstarea(0) == 1) { + firstarea(0) = firstarea(narea); + noofarea(0) = noofarea(0)+noofarea(narea); + compact = noofarea(narea); narea--; } } @@ -572,12 +567,12 @@ void MAT_Mat::CreateMat(Tool& atool) beginbisector = noofbisectors; shift = 0; all = 0; - if(narea == 1 && noofarea[0] == theedgelist->Number()) all = 1; + if(narea == 1 && noofarea(0) == theedgelist->Number()) all = 1; for(i=0; iFirst(); - edgetoremove = theedgelist->Brackets(firstarea[i]-shift); + edgetoremove = theedgelist->Brackets(firstarea(i)-shift); edgetoremove->FirstBisector()->EndPoint(edgetoremove ->IntersectionPoint()); @@ -605,7 +600,7 @@ void MAT_Mat::CreateMat(Tool& atool) bisectormap(noofbisectors)->AddBisector(edgetoremove ->FirstBisector()); - for(j=0; jUnlink(); theedgelist->Next(); shift++; @@ -614,7 +609,7 @@ void MAT_Mat::CreateMat(Tool& atool) cout<<" Suppression de l'arete : "<EdgeNumber()<AddBisector(edgetoremove ->SecondBisector()); } @@ -764,12 +759,6 @@ void MAT_Mat::CreateMat(Tool& atool) } } - //------------------------------------- - // Destruction des tableaux dynamiques. - //------------------------------------- - delete [] firstarea; - delete [] lastarea ; - delete [] noofarea ; } //======================================================================== -- 2.39.5