View Issue Details

IDProjectCategoryView StatusLast Update
0023901Open CASCADEOCCT:Modeling Algorithmspublic2013-12-19 13:55
ReporterabvAssigned Toomy 
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Product Version6.6.0 
Target Version6.7.0Fixed in Version6.7.0 
Summary0023901: Memory leaks in tests
DescriptionAfter integration of 0023818 the following memory leaks are detected in tests on Windows 32-bit under vc9:

  bugs caf bug23489
  bugs fclasses bug7287_1
  bugs fclasses bug7287_2
  bugs fclasses bug7287_3
  bugs fclasses bug7287_4
  bugs fclasses bug7287_5
  bugs fclasses bug7287_6
  bugs moddata_2 bug277

Note that the problems previously reported in 0023882 have appeared again
TagsNo tags attached.
Test case numberbugs fclasses(002) bug7287_1, bug7287_2, bug7287_3, bug7287_4, bug7287_5, bug7287_6; bugs moddata_2(012) bug277; bugs caf(015) bug23489

Relationships

related to 0023882 closedemv Open CASCADE Memory leak is reported on BOP in test bugs fclasses bug7287_5 
related to 0023489 closedRoman Lygin Community Memory leak in TNaming_NamedShape 
child of 0023818 closedomy Open CASCADE Extend OSD_MemInfo to report C heap statistics 

Activities

omy

2013-04-16 12:15

developer   ~0024151

There is a strange behavior in BOPDS_PaveBlock.cxx : 408-410

Handle_BOPDS_PaveBlock* pPB=(Handle_BOPDS_PaveBlock*)&myPB;
  *pPB=this;
  return myPB;

a handle is assigned to its object's field, so there is a cyclic reference.
What was the purpose of such an action?

omy

2013-04-16 14:10

developer   ~0024154

Dear abv,
Fix is integrated into branch CR23901.
Please, review.

Note: it fixes memory leaks in these test cases:

bugs fclasses bug7287_1
bugs fclasses bug7287_2
bugs fclasses bug7287_3
bugs fclasses bug7287_4
bugs fclasses bug7287_5
bugs fclasses bug7287_6
bugs moddata_2 bug277

Case bugs caf bug23489 still needs to be investigated.


emv

2013-04-16 15:17

developer   ~0024158

No remarks. Please test.

omy

2013-04-16 17:49

developer   ~0024168

Last edited: 2013-04-16 17:50

Case bugs caf bug23489 counts delta in bytes, so division of meminfo h result
 by 1024 will fix the fail result of the test.

apn

2013-04-17 14:02

administrator   ~0024185

Dear BugMaster,

Branch CR23901 (and products from GIT master) was compiled on Linux and Windows platforms and tested with rebase.
SHA-1: 12ebebce910774c171d0f971de934331234fc0d0

Number of compiler warnings:

occt component :
Linux: 2 (2 on master)
Windows: 11 (11 on master)

products component :
Linux: 0 (0 on master)
Windows: 50 (50 on master)

Regressions:
bugs fclasses bug7287_1 (Linux)
bugs caf bug23489 (Linux)

bugs fclasses bug7287_1 bug7287_2 bug7287_3 bug7287_4 bug7287_5 bug7287_6 (WNT)
bugs caf bug23489 (WNT)

Improvements:
No improvements

Testing on Linux:
Total MEMORY difference: 296163764 / 297145156
Total CPU difference: 26314.670000001104 / 23489.480000000534

Testing on Windows:
Total MEMORY difference: 405043084 / 406448920
Total CPU difference: 26397.671875 / 33983.71875

There are not serious differences in images found by testdiff.

abv

2013-04-22 09:29

manager   ~0024236

The problem with leaking ~3Kb of memory on each cycle remains in test bugs fclasses bug7287_1 and should be investigated. Other test cases in the list have been corrected to hide minor differences in memory usage.

abv

2013-04-24 08:40

manager   ~0024250

The problems reported by Dr. Memory on bugs fclasses bug7287_1:

1. Error #75: UNINITIALIZED READ: reading 0x0422d578-0x0422d580 8 byte(s)
# 0 TKBO.dll!IntTools_FaceFace::PrepareLines3D +0x10b9 (0x05c943a9 <TKBO.dll+0x243a9>)

The reason is not clear (no Debug data in my case), however it seems that constructor of IntTools_FaceFace does not initialize fields myDone and myNbrestr.

2. Error 0000112: LEAK 56 direct bytes 0x03300da0-0x03300dd8 + 240 indirect bytes
# 0 TKernel.dll!Standard_MMgrRaw::Allocate +0x19 (0x00218f0a <TKernel.dll+0x38f0a>)
# 1 TKernel.dll!Standard::Allocate +0x12 (0x00215af3 <TKernel.dll+0x35af3>)
# 2 TKBO.dll!BOPAlgo_Tools::PerformCommonBlocks +0xea (0x05cf3c5b <TKBO.dll+0x83c5b>)

It looks like one more case of cyclic handles: aCB (BOPDS_CommonBlock) refers to each BOPDS_PaveBlock in aLPB list, and each PaveBlock refers to that same aCB ...

Please check if this leak is true, and if so, whether this has been introduced in 6.6.0 or was also present earlier

abv

2013-04-24 12:05

manager   ~0024257

The cyclic reference is regression in 6.6.0; it does not present in previous versions. Please fix ASAP.

emv

2013-05-07 12:07

developer   ~0024318

Git branch CR23901 is ready to be reviewed.

abv

2013-05-07 14:41

manager   ~0024320

The memory leak seem to disappear (at least, both test and Dr. Memory pass reasonably Ok).

Updates test script is pushed to CR23901.

The fix is reviewed, please test.

Note that at the same time, Dr. Memory reports some problems with access to uninitialized memory, however I could not identify their possible reason:

Error #75: UNADDRESSABLE ACCESS: reading 0x0419e124-0x0419e128 4 byte(s)
# 0 TKBO.dll!BOPAlgo_PaveFiller::MakeSplitEdges +0x241 (0x06861c31 <TKBO.dll+0x81c31>)
# 1 TKBO.dll!BOPAlgo_PaveFiller::Perform +0x78 (0x068516b9 <TKBO.dll+0x716b9>)
# 2 tcl85.dll!TclInvokeStringCommand +0x64 (0x0162b675 <tcl85.dll+0xb675>)
# 3 tcl85.dll!Tcl_ListMathFuncs +0x3df (0x0162c8a0 <tcl85.dll+0xc8a0>)
# 4 tcl85.dll!Tcl_ExprObj +0x15b5 (0x016634b6 <tcl85.dll+0x434b6>)
# 5 tcl85.dll!Tcl_ExprObj +0x45b (0x0166235c <tcl85.dll+0x4235c>)
# 6 tcl85.dll!TclEvalObjEx +0x2af (0x0162dcf0 <tcl85.dll+0xdcf0>)
# 7 tcl85.dll!Tcl_DbCkfree +0x3f30 (0x016359b1 <tcl85.dll+0x159b1>)
# 8 tcl85.dll!Tcl_ListMathFuncs +0x3df (0x0162c8a0 <tcl85.dll+0xc8a0>)
# 9 tcl85.dll!Tcl_EvalEx +0x683 (0x0162d3d4 <tcl85.dll+0xd3d4>)
#10 tcl85.dll!Tcl_EvalEx +0x1d (0x0162cd6e <tcl85.dll+0xcd6e>)
0000011 tcl85.dll!Tcl_FSEvalFileEx +0x1c7 (0x016818b8 <tcl85.dll+0x618b8>)
Note: @0:00:31.641 in thread 6544
Note: instruction: cmp (%ebx) $0xfefd0000

Error 0000076: UNINITIALIZED READ: reading 0x0419d778-0x0419d780 8 byte(s)
# 0 TKBO.dll!IntTools_FaceFace::PrepareLines3D +0x1159 (0x068042d9 <TKBO.dll+0x242d9>)
# 1 TKBO.dll!IntTools_FaceFace::ComputeTolReached3d +0x1998 (0x06808779 <TKBO.dll+0x28779>)
# 2 TKBO.dll!IntTools_FaceFace::Perform +0x46f (0x06811bd0 <TKBO.dll+0x31bd0>)
# 3 TKBO.dll!BOPAlgo_PaveFiller::PerformFF +0x175 (0x06860556 <TKBO.dll+0x80556>)
# 4 TKBO.dll!BOPAlgo_PaveFiller::Perform +0x87 (0x068516c8 <TKBO.dll+0x716c8>)
# 5 tcl85.dll!TclInvokeStringCommand +0x64 (0x0162b675 <tcl85.dll+0xb675>)
# 6 tcl85.dll!Tcl_ListMathFuncs +0x3df (0x0162c8a0 <tcl85.dll+0xc8a0>)
# 7 tcl85.dll!Tcl_ExprObj +0x15b5 (0x016634b6 <tcl85.dll+0x434b6>)
# 8 tcl85.dll!Tcl_ExprObj +0x45b (0x0166235c <tcl85.dll+0x4235c>)
# 9 tcl85.dll!TclEvalObjEx +0x2af (0x0162dcf0 <tcl85.dll+0xdcf0>)
#10 tcl85.dll!Tcl_DbCkfree +0x3f30 (0x016359b1 <tcl85.dll+0x159b1>)
0000011 tcl85.dll!Tcl_ListMathFuncs +0x3df (0x0162c8a0 <tcl85.dll+0xc8a0>)
Note: @0:00:31.776 in thread 6544
Note: instruction: fld 0x38(%esp) -> %st0

mkv

2013-05-22 17:51

tester   ~0024472

Dear BugMaster,

Branch CR23901 (and products from GIT master) was compiled on Linux and Windows platforms and tested.
SHA-1: acab07965d9f8d15a50f4b5709b9138e2af9da7d

Number of compiler warnings:

occt component :
Linux: 2 (2 on master)
Windows: 11 (11 on master)

products component :
Linux: 0 (0 on master)
Windows: 64 (64 on master)

Regressions:
No regressions

Improvements:
No improvements

Testing cases:
bugs fclasses(002) bug7287_1, bug7287_2, bug7287_3, bug7287_4, bug7287_5, bug7287_6 - OK.
bugs moddata_2(012) bug277 - OK.
bugs caf(015) bug23489 - OK.

Testing on Linux:
Total MEMORY difference: 366042296 / 365872296
Total CPU difference: 42235.2700000009 / 45787.80000000135

Testing on Windows:
Total MEMORY difference: 417506300 / 420639628
Total CPU difference: 41252.6875 / 30741.921875

There are not differences in images found by testdiff.

Related Changesets

occt: master 323c04de

2013-04-17 13:15:29

omy

Details Diff
0023901: Memory leaks in tests
Removed a field from BOPDS_PaveBlock that contained the BOPDS_PaveBlock object itself.
Function RealPaveBlock() now returns a const handle, not a const reference to handle.
Removed const modifier because function now returns an object, not a reference to it.
Affected Issues
0023901
mod - src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx Diff File
mod - src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx Diff File
mod - src/BOPDS/BOPDS_DS.cxx Diff File
mod - src/BOPDS/BOPDS_PaveBlock.cdl Diff File
mod - src/BOPDS/BOPDS_PaveBlock.cxx Diff File

occt: master 5a77460e

2013-05-23 08:02:14

omy

Details Diff
0023901: Memory leaks in tests.
1. Removed cyclic reference. Removed field myCommonBlock from BOPDS_PaveBlock;
2. Added data map myMapPBCB in BOPDS_DS. It contains pairs (PaveBlock, CommonBlock);
3. All methods about common block have been shifted from BOPDS_PaveBlock to BOPDS_DS;
4. Test case bugs moddata_2 pro19422_2 has been rewritten to build the correct result.
Test case corrected (TODO removed)
Affected Issues
0023901
mod - src/BOPAlgo/BOPAlgo_Builder_1.cxx Diff File
mod - src/BOPAlgo/BOPAlgo_PaveFiller_3.cxx Diff File
mod - src/BOPAlgo/BOPAlgo_PaveFiller_5.cxx Diff File
mod - src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx Diff File
mod - src/BOPAlgo/BOPAlgo_PaveFiller_7.cxx Diff File
mod - src/BOPAlgo/BOPAlgo_Tools.cdl Diff File
mod - src/BOPAlgo/BOPAlgo_Tools.cxx Diff File
mod - src/BOPDS/BOPDS.cdl Diff File
add - src/BOPDS/BOPDS_DataMapOfPaveBlockCommonBlock.hxx Diff File
mod - src/BOPDS/BOPDS_DS.cdl Diff File
mod - src/BOPDS/BOPDS_DS.cxx Diff File
mod - src/BOPDS/BOPDS_PaveBlock.cdl Diff File
mod - src/BOPDS/BOPDS_PaveBlock.cxx Diff File
mod - src/BOPDS/FILES Diff File
mod - src/QANewModTopOpe/QANewModTopOpe_Tools.cxx Diff File
mod - tests/bugs/fclasses/bug7287_1 Diff File
mod - tests/bugs/moddata_2/pro19422_2 Diff File

Issue History

Date Modified Username Field Change
2013-04-15 07:24 abv New Issue
2013-04-15 07:24 abv Assigned To => jgv
2013-04-15 07:24 abv Assigned To jgv => omy
2013-04-15 07:24 abv Status new => assigned
2013-04-15 07:25 abv Relationship added child of 0023818
2013-04-15 07:25 abv Relationship added related to 0023882
2013-04-16 12:15 omy Note Added: 0024151
2013-04-16 12:18 dbv Note View State: 0024151: private
2013-04-16 12:18 dbv Note View State: 0024151: public
2013-04-16 14:10 omy Note Added: 0024154
2013-04-16 14:10 omy Assigned To omy => abv
2013-04-16 14:10 omy Status assigned => resolved
2013-04-16 14:11 omy Relationship added related to 0023489
2013-04-16 14:18 abv Assigned To abv => emv
2013-04-16 15:17 emv Note Added: 0024158
2013-04-16 15:17 emv Assigned To emv => apn
2013-04-16 15:17 emv Status resolved => reviewed
2013-04-16 17:49 omy Note Added: 0024168
2013-04-16 17:50 omy Note Edited: 0024168
2013-04-17 14:02 apn Note Added: 0024185
2013-04-17 14:03 apn Assigned To apn => omy
2013-04-17 14:03 apn Status reviewed => tested
2013-04-17 14:22 apn Status tested => assigned
2013-04-19 18:00 omy Changeset attached => occt master 323c04de
2013-04-19 18:00 omy Status assigned => verified
2013-04-19 18:00 omy Resolution open => fixed
2013-04-22 09:29 abv Note Added: 0024236
2013-04-22 09:29 abv Status verified => assigned
2013-04-22 11:22 abv Target Version 6.6.0 => 6.7.0
2013-04-24 08:40 abv Note Added: 0024250
2013-04-24 12:04 abv Assigned To omy => emv
2013-04-24 12:05 abv Note Added: 0024257
2013-05-07 12:07 emv Note Added: 0024318
2013-05-07 12:07 emv Assigned To emv => abv
2013-05-07 12:07 emv Status assigned => resolved
2013-05-07 14:41 abv Note Added: 0024320
2013-05-07 14:41 abv Assigned To abv => bugmaster
2013-05-07 14:41 abv Status resolved => reviewed
2013-05-22 12:14 bugmaster Assigned To bugmaster => mkv
2013-05-22 17:51 mkv Note Added: 0024472
2013-05-22 17:51 mkv Test case number => bugs fclasses(002) bug7287_1, bug7287_2, bug7287_3, bug7287_4, bug7287_5, bug7287_6; bugs moddata_2(012) bug277; bugs caf(015) bug23489
2013-05-22 17:51 mkv Assigned To mkv => bugmaster
2013-05-22 17:51 mkv Status reviewed => tested
2013-05-24 13:06 omy Changeset attached => occt master 5a77460e
2013-05-24 13:06 omy Assigned To bugmaster => omy
2013-05-24 13:06 omy Status tested => verified
2013-12-19 13:53 bugmaster Status verified => closed
2013-12-19 13:55 bugmaster Fixed in Version => 6.7.0