View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0026698 | Open CASCADE | OCCT:Coding | public | 2015-09-17 10:17 | 2023-08-01 15:09 |
Reporter | Assigned To | ||||
Priority | normal | Severity | minor | ||
Status | assigned | Resolution | open | ||
Target Version | Unscheduled | ||||
Summary | 0026698: Coding - Avoid usage of non-guarded pointers to dynamically allocated memory | ||||
Description | It is quite widespread in OCCT code, especially in modeling, to use plain C pointers to manage memory allocated dynamically, with explicit calls to new/malloc and delete/free. This is unsafe and bad practice, leading to memory leaks detected regularly (see e.g. #26616 as the most recent case), which must be eliminated. The natural and recommended way to deal with dynamically allocated memory is usage of smart pointers, typically OCCT Handles. Note that before OCCT 7.0 it was not always easy to use Handles to classes not inheriting Standard_Transient, especially for fields of CDL classes, due to non-trivial actions required. Now it should be quite easy to wrap any class to NCollection_Shared<> template and then manipulate it by Handle. There is however a potential issue when using Handles: they are not suitable for cases when memory is allocated via non-standard allocators (such as NCollection_IncAllocator). This is a problem to be investigated. Until it is resolved, std::shared_ptr<> with allocator argument could be used in such cases. | ||||
Tags | No tags attached. | ||||
Test case number | |||||
parent of | 0026915 | closed | bugmaster | Open CASCADE | Visualization - return Handle from Graphic3d_CView::FBOCreate() instead of a pointer |
related to | 0029442 | new | Open CASCADE | NCollection_Shared is unable to wrap classes without default constructor | |
related to | 0030603 | closed | bugmaster | Community | Memory Leaks in Geom_BSplineCurve |
Date Modified | Username | Field | Change |
---|---|---|---|
2015-09-17 10:17 |
|
New Issue | |
2015-09-17 10:17 |
|
Assigned To | => kgv |
2015-11-17 16:59 | kgv | Target Version | 7.0.0 => 7.1.0 |
2015-11-23 13:22 | kgv | Relationship added | parent of 0026915 |
2016-09-23 12:24 |
|
Assigned To | kgv => ski |
2016-09-23 12:24 |
|
Status | new => assigned |
2016-11-03 17:38 |
|
Target Version | 7.1.0 => 7.2.0 |
2017-07-20 12:29 | kgv | Target Version | 7.2.0 => 7.3.0 |
2018-01-18 17:13 |
|
Assigned To | ski => isn |
2018-01-22 18:02 |
|
Relationship added | related to 0029442 |
2018-02-25 23:12 |
|
Target Version | 7.3.0 => 7.4.0 |
2019-03-25 14:03 | BenjaminBihler | Relationship added | related to 0030603 |
2019-07-10 19:27 |
|
Target Version | 7.4.0 => 7.5.0 |
2020-09-11 15:34 |
|
Target Version | 7.5.0 => 7.6.0 |
2021-09-09 23:10 | kgv | Target Version | 7.6.0 => 7.7.0 |
2022-08-17 12:01 | kgv | Target Version | 7.7.0 => 7.8.0 |
2023-08-01 15:09 | dpasukhi | Target Version | 7.8.0 => Unscheduled |