View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0011789 | Community | OCCT:Modeling Algorithms | public | 2006-03-03 11:33 | 2011-11-25 15:06 |
Reporter | Assigned To | ||||
Priority | normal | Severity | trivial | ||
Status | closed | Resolution | fixed | ||
OS | All | ||||
Fixed in Version | 6.1.1 | ||||
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. ------------------------------------------------------ | ||||
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. | ||||
Test case number | |||||
2006-03-06 14:46
|
OCC11789-mkv-v1.tar.gz (213,072 bytes) |
|
Much regress in KAS:dev:OCC11789-opt regarding to Products. |
2006-03-10 15:25
|
OCC11789-mkv-v2.tar.gz (213,085 bytes) |
|
No regress in KAS:dev:OCC11789-opt regarding to Products on sun. |
2006-08-25 10:23
|
Bug11789.tar.gz (1,820 bytes) |
Date Modified | Username | Field | Change |
---|---|---|---|
2006-03-06 16:48 |
|
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 |
|
Status | assigned => resolved |
2006-08-25 19:28 |
|
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 |
|
Description Updated | |
2011-11-23 18:09 |
|
Additional Information Updated | |
2011-11-25 15:06 |
|
Summary | There is a severe memory leak in TopExp_Explorer methods Init and Clear. => Several memory leaks in TopExp_Explorer methods Init and Clear. |