DiscussionsIssue archiveOCCT:Foundation Classes

Archived issue #0029064

Copying of empty NCollection map takes excessive memory

Open CASCADEOCCT:Foundation Classesclosed18 public notes

Search issues

Description

NCollection_Map<int> aMap;
creates a map with myNbBuckets=1 and myData1=NULL, minimum memory is allocated

  NCollection_Map<int> aCopyMap = aMap;
produces a map with myNbBuckets=101 and myData1 referenced to newly allocated 816 bytes

  NCollection_Map<int> aCopyCopyMap = aCopyMap;
does the same, but in addition in "Assign" method it iterates all buckets to try to find elements to copy regardless mySize is 0

Steps to reproduce

.

Public activity

18 archived notes

Participants are labeled by their role within this record.

01Commenter 2
Branch [archived branch] has been created by Participant.

[revision removed]


Detailed log of new commits:

Author: isn
Date: Mon Jan 15 20:29:14 2018 +0300

    0029064: Copying of empty NCollection map takes excessive memory
    
    skip resizing of ncollection maps in Assign() methods if given map is empty
02Commenter 2
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
03Commenter 3
/view/CR29064-master-isn/
04Commenter 4
src/NCollection/NCollection_DataMap.hxx
src/NCollection/NCollection_DoubleMap.hxx
src/NCollection/NCollection_IndexedDataMap.hxx
src/NCollection/NCollection_IndexedMap.hxx
- Use the variable anExt to avoid calling theOther.Extent() once again.

src/QABugs/QABugs_20.cxx
- Avoid code duplication using template function.

- Add standard header in the scripts.
- The command pload is not needed in the scripts.
- Make a TCL procedure in the 'begin' file that makes all job and checks memory:
proc CheckMemPeak {script max_memory}
and simplify each script as follows:
CheckMemPeak {OCC29064 m} 15000000
05Commenter 2
Branch [archived branch] has been updated by Participant.

[revision removed]


Detailed log of new commits:

Author: isn
Date: Thu Jan 18 14:16:47 2018 +0300

    corrections

06Commenter 2
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
07Commenter 7
test job is same (/view/CR29064-master-isn/)
08Commenter 8
Please rebase on current master and retest.
09Commenter 2
Branch [archived branch] has been created by Participant.

[revision removed]


Detailed log of new commits:

Author: isn
Date: Thu Jan 18 14:16:47 2018 +0300

    corrections

Author: isn
Date: Mon Jan 15 20:29:14 2018 +0300

    0029064: Copying of empty NCollection map takes excessive memory
    
    skip resizing of ncollection maps in Assign() methods if given map is empty
10Commenter 10
rebased,
test job is view/CR29064_1-master-isn/
11Commenter 2
Branch [archived branch] has been created by Participant.

[revision removed]


Detailed log of new commits:

Author: isn
Date: Mon Jan 15 20:29:14 2018 +0300

    0029064: Copying of empty NCollection map takes excessive memory
    
    Avoid resizing of NCollection maps in Assign() methods if source map is empty
12Commenter 12
Reviewed with amendments, please integrate (branch CR29064_2, test results in Jenkins job CR29064-master-abv).

Some general remarks on implementation of test and DRAWC command:
- For small tests, having single test script is better than several ones (faster, more compact results, easier to control)
- In the code, please use spaces after comma and semicolon, around =, around (but not inside) parentheses and quotes
- Names of function arguments should begin with "the"
- Check availability of the data before using them (in initial implementation DRAW command did not check number of arguments but always used first one)
- In case of wrong arguments, give error message to cout and return 1
13Commenter 2
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
14Commenter 14
(The updated commit just improves some comments and output text in DRAW command)
15Commenter 1
Combination -
OCCT branch : [archived branch] SHA - [revision removed]
Products branch : [archived branch] SHA - [revision removed]
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.

Number of compiler warnings:
No new/fixed warnings

Regressions/Differences/Improvements:
No regressions/differences

CPU differences:
Debian70-64:
OCCT
Total CPU difference: 18300.449999999917 / 18135.489999999976 [+0.91%]
Products
Total CPU difference: 7413.520000000004 / 7435.139999999992 [-0.29%]
Windows-64-VC10:
OCCT
Total CPU difference: 17931.394544098617 / 17864.39211459853 [+0.38%]
Products
Total CPU difference: 8190.348901899946 / 8129.77371359997 [+0.75%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention
16Commenter 2
Branch [archived branch] has been deleted by Participant.

[revision removed]
17Commenter 2
Branch [archived branch] has been deleted by Participant.

[revision removed]
18Commenter 2
Branch [archived branch] has been deleted by Participant.

[revision removed]