View Issue Details

IDProjectCategoryView StatusLast Update
0022816CommunityOCCT:Foundation Classespublic2012-04-03 19:35
Reporterszy Assigned ToRoman Lygin  
PrioritynormalSeveritymajor 
Status closedResolutionfixed 
PlatformAOSL 
Product Version6.5.2 
Target Version6.5.3Fixed in Version6.5.3 
Summary0022816: Enhancement request: new[]/delete[] operators should be redefined to use OCC allocation
DescriptionPost from the Forum - http://www.opencascade.org/org/forum/thread_22253/.
RLN contribution.
"The new[] operator (e.g. used in arrays/vectors) is not redefined in OCC classes and thus does not take advantage of OCC memory allocation mechanism (Standard::Allocate(), Standard::Free()). Instead it defaults to standard new/delete [] operators.

Example:
TopTools_Array1OfShape anArray (1, 10);
will underneath call new TopoDS_Shape[10] which will NOT call Standard::Allocate().

We discussed this issue with ABV a while ago, so maybe there is already a bug registered. In this case, please just post an ID here for future tracking."
TagsNo tags attached.
Test case numberTest case is not required

Relationships

related to 0022815 closedbugmaster Missing delete operator for placement new 
related to 0022916 assignedski Use common prefix for macros in OCCT code 

Activities

abv

2011-11-30 19:18

manager   ~0018678

I suggest that along with this correction we pack all OCCT-specific declarations of new / delete into a macro (to be defined in Standard_Macro.hxx) and use it in all relevant classes.

dbv

2012-01-16 13:43

developer   ~0019136

Operators new[]/delete[] redefined in the macro OVERRIDE_MEMORY_OPERATORS (src/Standard/Standard_Macro.hxx) to use OCC allocation.

bug fixed in the branch: http://svn/svn/occt/branches/OCC22815

Dear Andrey,
Please review.

Roman Lygin

2012-01-18 14:39

developer   ~0019170

General comment:
Please think of a general policy of naming macros to ensure consistency and easy attribution to Open CASCADE. Often, macros are named with product prefix and underscores, for instance this could be:

__OCC_OVERRIDE_MEMORY_OPERATORS

abv

2012-01-18 19:59

manager   ~0019175

See review remarks in 0022815

barbier

2012-01-19 20:27

developer   ~0019186

Roman is right, macros used in installed header files should be prefixed by OCC_ to avoid name clashes. But please do not use leading underscores, such names are reserved in C++.

abv

2012-01-19 20:33

manager   ~0019187

Sure these names are reserved, thanks for commenting. We shall consider giving common prefix to macros in the future; in this particular fix I prefer to stick to using currently adopted pattern.

dbv

2012-01-20 11:58

developer   ~0019192

Dear Andrey,

check notes in http://tracker.dev.opencascade.org/view.php?id=22815

apn

2012-02-24 10:29

administrator   ~0019771

Workbench apn-OCC22815-occt/products was successfully tested in http://tracker.dev.opencascade.org/view.php?id=22815

bugmaster

2012-03-10 13:31

administrator   ~0019910

Problem was solved by fix for issue 22815

Issue History

Date Modified Username Field Change
2011-11-28 17:10 szy New Issue
2011-11-28 17:10 szy Assigned To => abv
2011-11-30 19:11 abv Assigned To abv => dbv
2011-11-30 19:11 abv Status new => assigned
2011-11-30 19:18 abv Note Added: 0018678
2011-12-01 11:21 szy Description Updated
2011-12-01 13:29 abv Description Updated
2012-01-16 13:43 dbv Note Added: 0019136
2012-01-16 13:43 dbv Assigned To dbv => abv
2012-01-16 13:43 dbv Status assigned => resolved
2012-01-18 13:00 atp Description Updated
2012-01-18 14:39 Roman Lygin Note Added: 0019170
2012-01-18 19:59 abv Note Added: 0019175
2012-01-18 19:59 abv Assigned To abv => dbv
2012-01-18 19:59 abv Status resolved => assigned
2012-01-18 20:00 abv Relationship added related to 0022815
2012-01-19 20:27 barbier Note Added: 0019186
2012-01-19 20:33 abv Note Added: 0019187
2012-01-19 20:36 abv Relationship added related to 0022916
2012-01-20 11:58 dbv Note Added: 0019192
2012-01-20 11:58 dbv Assigned To dbv => abv
2012-01-20 11:58 dbv Status assigned => resolved
2012-01-23 09:36 abv Status resolved => reviewed
2012-02-14 13:06 mkv Assigned To abv => apn
2012-02-24 10:29 apn Note Added: 0019771
2012-02-24 10:30 apn Assigned To apn => bugmaster
2012-02-24 10:30 apn Status reviewed => tested
2012-02-24 10:31 apn Test case number => Test case is not required
2012-03-10 13:31 bugmaster Note Added: 0019910
2012-03-10 13:31 bugmaster Status tested => verified
2012-03-10 13:31 bugmaster Resolution open => fixed
2012-03-10 13:31 bugmaster Assigned To bugmaster => dbv
2012-04-03 19:35 abv Assigned To dbv => Roman Lygin