View Issue Details

IDProjectCategoryView StatusLast Update
0021711Open CASCADEOCCT:Foundation Classespublic2012-01-10 16:02
ReporterabvAssigned Toabv 
PrioritynormalSeveritytrivial 
Status closedResolutionfixed 
OSAll 
Fixed in Version6.4.0 
Summary0021711: Assignment operator for maps in NCollection unnecessarily increases buckets array
DescriptionMap data structures in NCollection share common bug: in operator =, the target
map is resized using number of buckets of source map instead of its actual
content (extent). This leads to the fact that when map is copied, the resulting
map has buckets re-allocated to the next threshold value; this leads to
unnecessary allocation of memory.

The test executable demonstrating this behavior is attached. Its output on
current OCCT is:

:KAS:dev:abvdoc> testmap
Testing NCollection_Map
Initial number of buckets: 101
Copy 0000002: number of buckets = 2003
Copy #4: number of buckets = 10007
Copy #6: number of buckets = 37003
Copy 0000008: number of buckets = 65003
Copy #10: number of buckets = 209953
Copy #12: number of buckets = 995329
Copy 0000014: number of buckets = 995329
Copy 0000016: number of buckets = 995329
Copy 0000018: number of buckets = 995329
Copy 0000020: number of buckets = 995329
Testing TCollection_Map
Initial number of buckets: 101
Copy 0000002: number of buckets = 101
Copy #4: number of buckets = 101
Copy #6: number of buckets = 101
Copy 0000008: number of buckets = 101
Copy #10: number of buckets = 101
Copy #12: number of buckets = 101
Copy 0000014: number of buckets = 101
Copy 0000016: number of buckets = 101
Copy 0000018: number of buckets = 101
Copy 0000020: number of buckets = 101

Note that maps in TCollection does not suffer from such problem.
Additional information
and documentation updates
Documentation remark, added by ABV 2010-08-03 14:05:28:

Improvements:
The bug in copy function (operator =) of all map data structures in NCollection
has been fixed: the target map was resized using number of buckets of source map
instead of its actual content (extent). This led to unnecessary growth of
allocated memory whenever map was copied.
TagsNo tags attached.
Test case number

Attached Files

  • testmapcopy.tar.gz (661 bytes)
  • occ21711-abv-v1.tar.gz (7,812 bytes)

Activities

2010-04-22 19:38

 

testmapcopy.tar.gz (661 bytes)

2010-04-22 19:40

 

occ21711-abv-v1.tar.gz (7,812 bytes)

Issue History

Date Modified Username Field Change
2010-04-28 19:52 bugmaster Assigned To bugmaster => abv
2010-04-28 19:52 bugmaster Status new => assigned
2010-04-28 19:52 bugmaster Status assigned => tested
2010-07-28 16:12 bugmaster Status tested => verified
2011-08-02 11:23 bugmaster Category OCCT:FDC => OCCT:Foundation Classes
2012-01-10 16:02 atp Description Updated
2012-01-10 16:02 atp Additional Information Updated