MantisBT - Community |
View Issue Details |
|
ID | Project | Category | View Status | Date Submitted | Last Update |
0011789 | Community | [OCCT] OCCT:Modeling Algorithms | public | 2006-03-03 11:33 | 2011-11-25 15:06 |
|
Reporter | mkv | |
Assigned To | gka | |
Priority | normal | Severity | trivial | |
Status | closed | Resolution | fixed | |
Platform | | OS | All | OS Version | |
Product Version | | |
Target Version | | Fixed in Version | [OCCT] 6.1.1 | |
Test case number | |
|
Summary | 0011789: Several memory leaks in TopExp_Explorer methods Init and Clear. |
Description | -------- Original Message --------
Subject: [OCC Forum] Memory leak in TopExp_Explorer
Date: Mon, 16 Jan 2006 15:40:02 +0100
From: Christian R. Krug <Christian.Krug@pace.de>
This message was sent from www.opencascade.org
<http://www.opencascade.org> [^] forum.
http://www.opencascade.org/org/forum/thread_9297/ [^]
------------------------------------------------------
Hi Everybody !
There is a severe memory leak in TopExp_Explorer methods Init and Clear.
If the member field myTop is greater -1, resp. 0, the destructor for
all TopoDS_Iterator's on the current stack is never called.
For example in BRepLib_FindSurface the Init method for the same
TopExp_Explorer is called repeatedly. This has the effect that the
reference counter for the first edge of a given face is continuously
increasing, and its memory can never be freed.
I suspect, that one of the previous maintainance releases already
incorporates a fix for this leakage. But for all non-commercial users
of Open CASCADE, I give an outline of the solution to this problem.
Modify Init and Clear methods so that the destructors get called:
void TopExp_Explorer::Init(const TopoDS_Shape& S,
const TopAbs_ShapeEnum ToFind,
const TopAbs_ShapeEnum ToAvoid)
{
if(myTop >= 0)
for(int i = 0; i <= myTop; ++i)
myStack[i].~TopoDS_Iterator();
myTop = -1;
[...]
}
void TopExp_Explorer::Clear()
{
hasMore = Standard_False;
if(myTop > 0)
for(int i = 1; i <= myTop; ++i)
myStack[i].~TopoDS_Iterator();
myTop = 0;
}
Both forms of the TopExp_Explorer constructor have to initialize the
member fields:
: myStack(0L), myTop(-1), mySizeOfStack(theStackSize)
and ReInit needs only call Init:
void TopExp_Explorer::ReInit()
{
Init(myShape,toFind,toAvoid);
}
Regards, Kris.
------------------------------------------------------ |
Steps To Reproduce | |
Additional information and documentation updates | Documentation remark, added by gka 2006-08-25 10:28:55:
Improvements:
Added code removing previously created objects having type TopoDS_Iterator in
the methods Init() and Clear(). |
Tags | No tags attached. |
Relationships | |
Attached Files | OCC11789-mkv-v1.tar.gz (213,072) 2006-03-06 14:46 https://tracker.dev.opencascade.org/
OCC11789-mkv-v2.tar.gz (213,085) 2006-03-10 15:25 https://tracker.dev.opencascade.org/
Bug11789.tar.gz (1,820) 2006-08-25 10:23 https://tracker.dev.opencascade.org/ |
|
Issue History |
Date Modified | Username | Field | Change |
2006-03-06 16:48 | mkv | CC | => mkv |
2006-03-09 16:17 | bugmaster | groupset1 | => 4096 |
2006-03-09 16:17 | bugmaster | Customer | => Community |
2006-08-22 17:14 | bugmaster | Assigned To | bugmaster => gka |
2006-08-22 17:14 | bugmaster | Status | new => assigned |
2006-08-25 12:23 | gka | Status | assigned => resolved |
2006-08-25 19:28 | mkv | Status | resolved => tested |
2006-09-06 09:43 | bugmaster | Status | tested => verified |
2006-10-26 19:18 | bugmaster | Status | verified => closed |
2006-10-26 19:18 | bugmaster | Resolution | @0@ => fixed |
2011-08-02 11:31 | bugmaster | Category | OCCT:MOA => OCCT:Modeling Algorithms |
2011-11-23 18:09 | szy | Description Updated | bug_revision_view_page.php?rev_id=948#r948 |
2011-11-23 18:09 | szy | Additional Information Updated | bug_revision_view_page.php?rev_id=950#r950 |
2011-11-25 15:06 | szy | Summary | There is a severe memory leak in TopExp_Explorer methods Init and Clear. => Several memory leaks in TopExp_Explorer methods Init and Clear. |