View Issue Details

IDProjectCategoryView StatusLast Update
0002499CommunityOCCT:Foundation Classespublic2011-11-29 10:57
Reporterbugmaster Assigned Toszy  
Status closedResolutionfixed 
Fixed in Version5.1.0 
Summary0002499: The assignation operator for all the maps assignation is bugged
DescriptionBug from Open CASCADE community

Autors: Joel Donneux & Ivan Fontaine

Well, a new candidate for the "Bug of Year" contest.

The assignation operator for all the maps assignation is bugged.
The destination map is resized using the number of buckets of the
map. The result of this is that during an assignation all the destination maps
are sized to the "NextPrime" size.

If you have a map with one element and if you copy it 26 times,
you end up with a map having 100019 buckets to store one element.

And if your application has some map of maps and that you use CAF,
you can potentially use hundreds of mega bytes to store a few Standard_Integer

Needless to say, Cascade is rather memory hungry, and this bug makes
the situation even worst.

You should alter all your maps definitions in a way like this:

TCollection_Map& TCollection_Map::Assign(const TCollection_Map& Other)
if (this == &Other) return *this;
 // **** modif
// ReSize() uses the TCollection::NextPrimeForMap() to get the next bucket size,
// so, the bucket size grows at each copy, even in the number of object
// in the map is constant !
// ReSize(Other.NbBuckets());
if (!Other.IsEmpty()) {
// **** END modif
for (TCollection_MapIterator It(Other); It.More(); It.Next()) {
return *this;

Joel Donneux & Ivan Fontaine
TagsNo tags attached.
Test case number

Attached Files

  • B2499.tar.gz (4,610 bytes)


2003-05-07 15:52


B2499.tar.gz (4,610 bytes)

Issue History

Date Modified Username Field Change
2003-04-28 15:25 bugmaster Assigned To bugmaster => szy
2003-04-28 15:25 bugmaster Status new => assigned
2003-04-28 15:25 bugmaster Summary => The assignation operator for all the maps assignation is bugged
2003-05-12 19:46 bugmaster Status assigned => resolved
2003-05-15 20:19 apv CC => apv
2003-05-15 20:20 apv CC => aki
2003-05-23 22:18 aki Status resolved => tested
2003-06-02 12:13 bugmaster Status tested => closed
2003-06-02 12:13 bugmaster Resolution @0@ => fixed
2004-12-30 11:32 bugmaster Customer =>
2011-08-02 11:23 bugmaster Category OCCT:FDC => OCCT:Foundation Classes
2011-11-29 10:57 bugmaster Description Updated