Add destructor of MAT2d_Mat2d - full removal of edges and bisectors.
public:
-
Standard_EXPORT MAT_ListOfBisector();
+ Standard_EXPORT ~MAT_ListOfBisector();
+
Standard_EXPORT void First();
Standard_EXPORT void Last();
public:
-
Standard_EXPORT MAT_ListOfEdge();
+
+ Standard_EXPORT ~MAT_ListOfEdge();
Standard_EXPORT void First();
Standard_Boolean nextisnull = thecurrentnode->Next().IsNull();
if(thecurrentindex)
+ {
+ if(!nextisnull)
{
- if(!nextisnull && !previousisnull)
- {
- thecurrentnode->Next()->Previous(thecurrentnode->Previous());
- thecurrentnode->Previous()->Next(thecurrentnode->Next());
- }
+ thecurrentnode->Next()->Previous(thecurrentnode->Previous());
+ }
+ if (!previousisnull)
+ {
+ thecurrentnode->Previous()->Next(thecurrentnode->Next());
+ }
- if(thecurrentindex == 1)
- {
- thefirstnode = thecurrentnode->Next();
- }
- else if(thecurrentindex == thenumberofitems)
- {
- thelastnode = thecurrentnode->Previous();
- }
+ if(thecurrentindex == 1)
+ {
+ thefirstnode = thecurrentnode->Next();
}
+ else if(thecurrentindex == thenumberofitems)
+ {
+ thelastnode = thecurrentnode->Previous();
+ }
+ }
thenumberofitems--;
thecurrentindex--;
}
{
for(First(); More(); Next()) Current()->Dump(ashift,alevel);
}
+
+//=======================================================================
+//function : ~MAT_TList
+//purpose :
+//=======================================================================
+
+MAT_TList::~MAT_TList()
+{
+ Handle(MAT_TListNode) aNode = thefirstnode;
+ while (!aNode.IsNull())
+ {
+ Handle(MAT_TListNode) aNext = aNode->Next();
+ aNode->Next (NULL);
+ aNode->Previous (NULL);
+ aNode = aNext;
+ }
+ thecurrentnode.Nullify();
+ thefirstnode.Nullify();
+ thelastnode.Nullify();
+ thecurrentindex = 0;
+ thenumberofitems = 0;
+}
// du contour.
// --------------------------------------------------------------------
theedgelist = new MAT_ListOfEdge();
+ RemovedEdgesList = new MAT_ListOfEdge();
for(i=0; i<noofedges; i++) {
edge = new MAT_Edge();
previousedge = currentedge;
currentbisectorlist->Next();
}
-
+
+ RemovedEdgesList->BackAdd(theedgelist->Current());
theedgelist->Unlink();
//-----------------------------------------------------------
->FirstBisector());
for(j=0; j<noofarea(i); j++) {
+ RemovedEdgesList->BackAdd(theedgelist->Current());
theedgelist->Unlink();
theedgelist->Next();
shift++;
// du contour.
// --------------------------------------------------------------------
theedgelist = new MAT_ListOfEdge();
+ RemovedEdgesList = new MAT_ListOfEdge();
for(i=0; i<noofedges; i++) {
edge = new MAT_Edge();
currentbisectorlist->Next();
}
+ RemovedEdgesList->BackAdd(theedgelist->Current());
theedgelist->Unlink();
//-----------------------------------------------------------
->FirstBisector());
for(j=0; j<noofarea(i); j++) {
+ RemovedEdgesList->BackAdd(theedgelist->Current());
theedgelist->Unlink();
theedgelist->Next();
shift++;
return isDone;
}
+//=======================================================================
+//function : ~MAT2d_Mat2d
+//purpose :
+//=======================================================================
+
+MAT2d_Mat2d::~MAT2d_Mat2d()
+{
+ MAT_DataMapIteratorOfDataMapOfIntegerBisector itmap(bisectormap);
+ for (; itmap.More(); itmap.Next())
+ {
+ Handle(MAT_Bisector) aBisector = itmap.Value();
+ aBisector->FirstEdge(NULL);
+ aBisector->SecondEdge(NULL);
+ }
+
+ if (!theedgelist.IsNull())
+ {
+ theedgelist->First();
+ for (Standard_Integer i = 1; i <= theedgelist->Number(); i++)
+ {
+ Handle(MAT_Edge) anEdge = theedgelist->Current();
+ anEdge->FirstBisector(NULL);
+ anEdge->SecondBisector(NULL);
+ theedgelist->Next();
+ }
+ }
+ if (!RemovedEdgesList.IsNull())
+ {
+ RemovedEdgesList->First();
+ for (Standard_Integer i = 1; i <= RemovedEdgesList->Number(); i++)
+ {
+ Handle(MAT_Edge) anEdge = RemovedEdgesList->Current();
+ anEdge->FirstBisector(NULL);
+ anEdge->SecondBisector(NULL);
+ RemovedEdgesList->Next();
+ }
+ }
+}
//! Empty construtor.
Standard_EXPORT MAT2d_Mat2d(const Standard_Boolean IsOpenResult = Standard_False);
+ Standard_EXPORT ~MAT2d_Mat2d();
+
//! Algoritm of computation of the bisecting locus.
Standard_EXPORT void CreateMat (MAT2d_Tool2d& aTool);
Standard_Integer thenumberofedges;
Standard_Boolean semiInfinite;
Handle(MAT_ListOfEdge) theedgelist;
+ Handle(MAT_ListOfEdge) RemovedEdgesList;
TColStd_DataMapOfIntegerInteger typeofbisectortoremove;
MAT_DataMapOfIntegerBisector bisectoronetoremove;
MAT_DataMapOfIntegerBisector bisectortwotoremove;
--- /dev/null
+puts "================================================="
+puts "OCC31120: Memory leak in BRepOffsetAPI_MakeOffset"
+puts "================================================="
+puts ""
+
+restore [locate_data_file bug31120_wire.brep] w
+
+mkoffset r w 1 0.5
+set log [meminfo h]
+regexp {([0-9+-.eE]*)} $log full memval1
+
+for {set i 0} {$i < 20} {incr i} {
+ mkoffset r w 1 0.5
+ set log [meminfo h]
+ regexp {([0-9+-.eE]*)} $log full memval
+
+ set ratio (${memval}-{$memval1})/${memval1}
+
+ if { ${ratio} > 0.05} {
+ puts "Error: memory leak"
+ }
+}