View Issue Details

IDProjectCategoryView StatusLast Update
0027567Open CASCADEOCCT:VISpublic2016-12-09 16:38
ReporterabvAssigned Tobugmaster  
PriorityhighSeverityminor 
Status closedResolutionfixed 
Target Version7.1.0Fixed in Version7.1.0 
Summary0027567: VIS - possible memory leaks due to use of plain pointers
DescriptionAs suggested by fix for memory leak made in OCE, the fix for 0026625 is incomplete, and memory leaks still remain in IVtkVTK_ShapeData.cxx.

The reffered OCE commit is:
https://github.com/tpaviot/oce/commit/e6847828a024f5dfeb13ca72a13838e959790626

The problem is on line 41 in current OCCT master (c5c7af4b7):

> myPolyData->SetPoints (vtkPoints::New());

Here method New() returns object with reference counter = 1, which will never be destroyed.

Apparently the same problem exists in

- method IVtkTools_SubPolyDataFilter::RequestData(), variable anIdList
- IVtkTools_ShapeObject.cxx, lines 91 and 111

In some places pointer obtained by call to unguarded New() is returned from a function, e.g. IVtkTools::InitLookupTable(). When this function is used (e.g. in InitShapeMapper()), there is nothing that implies that the memory will be returned, thus I suspect that this also will lead to memory leaks.

The safe approach should be to always use smart pointers and never call unguarded New().
Steps To ReproduceFixed.
The new test has been added: v3d/ivtk/bug27567
TagsNo tags attached.
Test case numberbugs vis bug27567

Relationships

related to 0027734 closedbugmaster Community Configuration - TKIVtkDraw build fails with TBB 
child of 0026625 closedbugmaster Community Possible wrong use of vtkSmartPointer<T> in IVtkVTK_ShapeData.cxx 

Activities

git

2016-08-23 15:50

administrator   ~0056974

Branch CR27567 has been created by rkv.

SHA-1: 46f2d2914c3a85fea25e8a8b140fadfd5f1715cc


Detailed log of new commits:

Author: rkv
Date: Tue Aug 23 15:52:11 2016 +0300

    0027567: VIS - possible memory leaks due to use of plain pointers: Fixed according to http://www.vtk.org/Wiki/VTK/Tutorials/SmartPointers

rkv

2016-08-23 16:14

developer   ~0056979

Please note that it is necessary to fix guide also at https://www.opencascade.com/doc/occt-6.9.0/overview/html/occt_user_guides__vis.html

The line
vtkLookupTable* Table = IVtkTools::InitLookupTable();

should be replaced by the following:
vtkSmartPointer<vtkLookupTable> Table = IVtkTools::InitLookupTable();

git

2016-08-23 16:53

administrator   ~0056985

Branch CR27567 has been updated by rkv.

SHA-1: 76eaf7557fb339fba7d797f10c81ff8a20850780


Detailed log of new commits:

Author: rkv
Date: Tue Aug 23 16:55:05 2016 +0300

    0027567: VIS - possible memory leaks due to use of plain pointers: Fix the VIS guide.

san

2016-08-23 21:54

developer   ~0057009

Please prepare a Git branch with a single combined commit.

git

2016-08-24 08:37

administrator   ~0057011

Branch CR27567 has been updated by rkv.

SHA-1: afb707a1350362c5781a7f287214a4900186546c


Detailed log of new commits:

Author: rkv
Date: Wed Aug 24 08:38:56 2016 +0300

    Merge branch 'CR27567' of git.dev.opencascade.org:occt into CR27567

Author: rkv
Date: Tue Aug 23 15:52:11 2016 +0300

    0027567: VIS - possible memory leaks due to use of plain pointers: Fix the VIS guide.
    http://www.vtk.org/Wiki/VTK/Tutorials/SmartPointers

git

2016-08-24 08:48

administrator   ~0057012

Branch CR27567 has been updated forcibly by rkv.

SHA-1: 3b2f972d65100cb3efd352f877ffc0f7a443fe01

git

2016-08-24 16:09

administrator   ~0057034

Branch CR27567 has been updated forcibly by rkv.

SHA-1: 8059b0eeb79607c1e4e275ce1088a4d87b5190a6

san

2016-08-24 16:32

developer   ~0057036

Can you please create a test case that detects memory leaks after multiple more or less complete IVtk usage cycles (display a shape in VTK view, activate selection modes, select some entities, delete a shape and all its data from VTK)?

See test case bugs vis bug26538 as an example of memory leak detection.

git

2016-08-30 20:54

administrator   ~0057311

Branch CR27567 has been updated forcibly by rkv.

SHA-1: 32a76b05e1bd595e9ddd6b7c0159765c1fc59e6a

git

2016-08-31 09:20

administrator   ~0057313

Branch CR27567 has been updated forcibly by rkv.

SHA-1: 6de99bc31cd60a60b51435622a18497c62428859

kgv

2016-08-31 11:13

developer   ~0057317

- Please correct commit so that author and committer will be the same.
- Please remove external URLs from the commit description.

git

2016-08-31 13:12

administrator   ~0057328

Branch CR27567 has been updated forcibly by rkv.

SHA-1: fd4e3decabe7c3716031380cf4fd4fe0a02722aa

git

2016-09-01 11:09

administrator   ~0057377

Branch CR27567 has been updated forcibly by rkv.

SHA-1: 646b7d83f7648ae5ec144c796149204c21adfae4

san

2016-09-01 15:38

developer   ~0057391

Branch CR27567 reviewed without remarks, ready for testing.

git

2016-09-01 17:26

administrator   ~0057396

Branch CR27567 has been updated forcibly by mkv.

SHA-1: 4db99844eb5c6ed9b3ef6c60b99e6e92ab8681f0

mkv

2016-09-02 13:21

tester   ~0057410

Dear BugMaster,
Branch CR27567 was rebased on IR-2016-09-01 of occt git-repository.

mkv

2016-09-02 13:22

tester   ~0057411

Dear BugMaster,
Branch CR27567 from occt git-repository (and IR-2016-09-01 from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested on Release mode.
SHA-1: 4db99844eb5c6ed9b3ef6c60b99e6e92ab8681f0

Number of compiler warnings:

occt component :
Linux: 0 (0 on master)
Windows: 0 (0 on master)
MacOS : 0 (0 on master)

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

Regressions/Differences/Improvements:
No regressions/differences

Testing cases:
http://occt-tests/CR27567-master-OCCT/Debian70-64/bugs/vis/bug27567.html
http://occt-tests/CR27567-master-OCCT/Windows-64-VC10/bugs/vis/bug27567.html
bugs vis bug27567: FAILED (exception)

Testing on Linux:
occt component :
Total MEMORY difference: 89312840 / 89476228 [-0.18%]
Total CPU difference: 19317.560000000005 / 19241.180000000015 [+0.40%]
products component :
Total MEMORY difference: 30011013 / 29985574 [+0.08%]
Total CPU difference: 5109.999999999963 / 5115.309999999973 [-0.10%]

Testing on Windows:
occt component :
Total MEMORY difference: 57147679 / 57155154 [-0.01%]
Total CPU difference: 18213.8031543988 / 18057.115749998855 [+0.87%]
products component :
Total MEMORY difference: 21260683 / 21225231 [+0.17%]
Total CPU difference: 4898.322199299956 / 4849.119483899957 [+1.01%]

There are no differences in images found by testdiff.

mkv

2016-09-02 13:22

tester   ~0057412

Dear rkv,
Branch CR27567 has been rejected due to:
- failed test-case for issue


There are 2 variants of correction for test case bugs vis bug27567:
1 - add drow-command "pload VIS"
2 - move test case to v3d/ivtk test group

git

2016-09-02 14:29

administrator   ~0057417

Branch CR27567 has been updated forcibly by rkv.

SHA-1: 21424f60e5b1e1d3e05839ea33888f4d64601db7

san

2016-09-02 14:38

developer   ~0057423

Branch CR27567 without remarks, ready for testing.

git

2016-09-02 15:36

administrator   ~0057429

Branch CR27567 has been updated forcibly by mkv.

SHA-1: e6539de314bf67d52646e73a61a5a65bc25c470a

mkv

2016-09-05 19:32

tester   ~0057486

Dear BugMaster,
test case was retested.

Testing cases:
http://occt-tests/CR27567-master-OCCT/Debian70-64/v3d/ivtk/bug27567.html
v3d ivtk bug27567: FAILED
Tcl Exception: Memory leak detected

http://occt-tests/CR27567-master-OCCT/Windows-64-VC10/v3d/ivtk/bug27567.html
v3d ivtk bug27567: OK

mkv

2016-09-05 19:33

tester   ~0057487

Dear rkv,
Branch CR27567 has been rejected due to:
- failed test-case for issue

git

2016-09-06 15:41

administrator   ~0057521

Branch CR27567 has been updated forcibly by rkv.

SHA-1: 8307146a1b813f300b6037caa3b21c3076d420d6

san

2016-09-06 15:52

developer   ~0057522

Last edited: 2016-09-06 15:53

Branch CR27567 reviewed without remarks.

Please, check the results of the corrected test case v3d ivtk bug27567 under Linux only, complete re-testing not needed.

mkv

2016-09-06 17:11

tester   ~0057527

Dear BugMaster,
test case was retested.

Testing cases:
http://occt-tests/CR27567-master-OCCT/Debian70-64/v3d/ivtk/bug27567.html [^]
v3d ivtk bug27567: FAILED
Tcl Exception: Memory leak detected

san

2016-09-06 17:27

developer   ~0057529

Memory leak of 118 kbyte per iteration is beyond the negligible limit.

Thus the following steps are proposed:
- Try to understand why other test cases involving "checktrend" do not fail under Linux - or better to say, what makes bug27567 test case fail while the other similar ones do not, of course if there is some "suspicious" difference in the test scripts.
- If the problem cannot be solved at the level of the test script, analyze the reasons for such noticeable memory leaks under Linux (similarly to the analysis completed for Windows).

git

2016-09-09 16:45

administrator   ~0057648

Branch CR27567 has been updated forcibly by rkv.

SHA-1: b48f0508f8c2ea82e777e41b35f0d516504ad631

san

2016-09-12 19:30

developer   ~0057707

Can you please finalize correction of this issue?

git

2016-09-14 13:56

administrator   ~0057778

Branch CR27567 has been updated forcibly by rkv.

SHA-1: 2470ca028ae7d1bf59ac6d5a649dbaac84977f22

git

2016-09-14 14:34

administrator   ~0057783

Branch CR27567 has been updated forcibly by rkv.

SHA-1: 84e111623151b1afc0ab1f7e3231d720785fb1c3

git

2016-09-14 16:55

administrator   ~0057792

Branch CR27567 has been updated forcibly by rkv.

SHA-1: c9dc99aa1d22a6b401d1d5f429856fafa3f61df9

rkv

2016-09-14 16:59

developer   ~0057793

The reason of memory increase on Linux is virtual windows mode used by testgrid and offscreen rendering in this mode. The related bug #0027871 is created.

git

2016-09-14 19:32

administrator   ~0057804

Branch CR27567 has been updated forcibly by rkv.

SHA-1: 6ff26ef91dd74634a0ecb0ee4f4d617d27ca4b2f

san

2016-09-14 19:38

developer   ~0057806

Branch CR27567 reviewed without remarks, ready for testing.

It includes also the patch for 0027734 - thus please test branch compilation with TBB enabled under Windows!

mkv

2016-09-15 15:20

tester   ~0057823

Dear rkv,
could you please rebase branch CR27567 on IR-2016-09-15.

git

2016-09-15 17:24

administrator   ~0057830

Branch CR27567 has been updated forcibly by rkv.

SHA-1: ea91fbb950851e4a7f190eb22067d4e936831d41

mkv

2016-09-19 13:55

tester   ~0057920

Dear BugMaster,
Branch CR27567 from occt git-repository (and IR-2016-09-15 from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested on Release mode.
SHA-1: ea91fbb950851e4a7f190eb22067d4e936831d41

Number of compiler warnings:

occt component :
Linux: 0 (0 on master)
Windows: 0 (0 on master)
MacOS : 0 (0 on master)

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

Regressions/Differences/Improvements:
No regressions/differences

Testing cases:
http://occt-tests/CR27567-master-OCCT/Debian70-64/v3d/ivtk/bug27567.html
http://occt-tests/CR27567-master-OCCT/Windows-64-VC10/v3d/ivtk/bug27567.html
v3d ivtk bug27567: OK

Testing on Linux:
occt component :
Total MEMORY difference: 90268969 / 89797117 [+0.53%]
Total CPU difference: 19278.499999999996 / 19211.76999999994 [+0.35%]
products component :
Total MEMORY difference: 29989654 / 29998572 [-0.03%]
Total CPU difference: 5070.319999999974 / 5119.779999999977 [-0.97%]

Testing on Windows:
occt component :
Total MEMORY difference: 57204088 / 57211877 [-0.01%]
Total CPU difference: 18218.997987698815 / 18509.12864749872 [-1.57%]
products component :
Total MEMORY difference: 21267626 / 21232183 [+0.17%]
Total CPU difference: 4830.399363899943 / 4959.0221883999575 [-2.59%]

There are no differences in images found by testdiff.

git

2016-09-19 13:55

administrator   ~0057921

Branch CR27567 has been updated by mkv.

SHA-1: 4d141a23091fc5c848ff78dd58aaf1c309dab5aa


Detailed log of new commits:

Author: mkv
Date: Mon Sep 19 13:55:17 2016 +0300

    Small correction of test case for issue CR27567

mkv

2016-09-19 13:56

tester   ~0057922

Dear BugMaster,
Branch CR27567 is TESTED.

git

2016-10-28 21:45

administrator   ~0059495

Branch CR27567 has been deleted by kgv.

SHA-1: 4d141a23091fc5c848ff78dd58aaf1c309dab5aa

Related Changesets

occt: master a2f76b15

2016-08-23 12:52:11

rkv


Committer: bugmaster Details Diff
0027567: VIS - possible memory leaks due to use of plain pointers: Fix also the VIS guide. Add the test v3d/ivtk/bug27567. Add a draw command "ivtkremove".
0027734: Configuration - TKIVtkDraw build fails with TBB: Remove unnecessary define statement (windows specific).

Small correction of test case for issue CR27567
Affected Issues
0027567
mod - dox/user_guides/vis/vis.md Diff File
mod - src/Draw/Draw_Interpretor.cxx Diff File
mod - src/DrawResources/TestCommands.tcl Diff File
mod - src/IVtkDraw/IVtkDraw.cxx Diff File
mod - src/IVtkDraw/IVtkDraw_HighlightAndSelectionPipeline.cxx Diff File
mod - src/IVtkDraw/IVtkDraw_Interactor.cxx Diff File
mod - src/IVtkOCC/IVtkOCC_SelectableObject.cxx Diff File
mod - src/IVtkOCC/IVtkOCC_SelectableObject.hxx Diff File
mod - src/IVtkOCC/IVtkOCC_ShapeMesher.cxx Diff File
mod - src/IVtkOCC/IVtkOCC_ShapePickerAlgo.cxx Diff File
mod - src/IVtkOCC/IVtkOCC_ShapePickerAlgo.hxx Diff File
mod - src/IVtkOCC/IVtkOCC_ViewerSelector.cxx Diff File
mod - src/IVtkOCC/IVtkOCC_ViewerSelector.hxx Diff File
mod - src/IVtkTools/IVtkTools.cxx Diff File
mod - src/IVtkTools/IVtkTools.hxx Diff File
mod - src/IVtkTools/IVtkTools_DisplayModeFilter.hxx Diff File
mod - src/IVtkTools/IVtkTools_ShapeDataSource.cxx Diff File
mod - src/IVtkTools/IVtkTools_ShapeDataSource.hxx Diff File
mod - src/IVtkTools/IVtkTools_ShapeObject.cxx Diff File
mod - src/IVtkTools/IVtkTools_ShapeObject.hxx Diff File
mod - src/IVtkTools/IVtkTools_ShapePicker.cxx Diff File
mod - src/IVtkTools/IVtkTools_ShapePicker.hxx Diff File
mod - src/IVtkTools/IVtkTools_SubPolyDataFilter.cxx Diff File
mod - src/IVtkTools/IVtkTools_SubPolyDataFilter.hxx Diff File
mod - src/IVtkVTK/IVtkVTK_ShapeData.cxx Diff File
mod - src/IVtkVTK/IVtkVTK_ShapeData.hxx Diff File
mod - src/IVtkVTK/IVtkVTK_View.cxx Diff File
mod - src/IVtkVTK/IVtkVTK_View.hxx Diff File
mod - tests/bugs/begin Diff File
add - tests/v3d/ivtk/bug27567 Diff File

Issue History

Date Modified Username Field Change
2016-06-02 22:12 abv New Issue
2016-06-02 22:12 abv Assigned To => san
2016-06-02 22:12 abv Relationship added child of 0026625
2016-06-03 10:40 san Assigned To san => aba
2016-06-07 06:47 abv Status new => assigned
2016-06-07 06:47 abv Priority normal => high
2016-07-01 16:30 san Assigned To aba => san
2016-08-01 19:40 san Assigned To san => aba
2016-08-18 20:19 san Assigned To aba => rkv
2016-08-23 15:50 git Note Added: 0056974
2016-08-23 15:58 rkv Assigned To rkv => san
2016-08-23 15:58 rkv Status assigned => resolved
2016-08-23 15:58 rkv Steps to Reproduce Updated
2016-08-23 16:14 rkv Note Added: 0056979
2016-08-23 16:53 git Note Added: 0056985
2016-08-23 21:54 san Note Added: 0057009
2016-08-23 21:54 san Assigned To san => rkv
2016-08-23 21:54 san Status resolved => assigned
2016-08-24 08:37 git Note Added: 0057011
2016-08-24 08:48 git Note Added: 0057012
2016-08-24 08:57 rkv Assigned To rkv => san
2016-08-24 08:57 rkv Status assigned => resolved
2016-08-24 08:57 rkv Steps to Reproduce Updated
2016-08-24 10:57 san Assigned To san => rkv
2016-08-24 10:57 san Status resolved => assigned
2016-08-24 16:09 git Note Added: 0057034
2016-08-24 16:10 rkv Assigned To rkv => san
2016-08-24 16:10 rkv Status assigned => resolved
2016-08-24 16:10 rkv Steps to Reproduce Updated
2016-08-24 16:32 san Note Added: 0057036
2016-08-24 16:32 san Assigned To san => rkv
2016-08-24 16:32 san Status resolved => assigned
2016-08-30 20:54 git Note Added: 0057311
2016-08-30 20:58 rkv Assigned To rkv => san
2016-08-30 20:58 rkv Status assigned => resolved
2016-08-30 20:58 rkv Steps to Reproduce Updated
2016-08-31 09:20 git Note Added: 0057313
2016-08-31 11:13 kgv Note Added: 0057317
2016-08-31 13:12 git Note Added: 0057328
2016-09-01 11:09 git Note Added: 0057377
2016-09-01 15:38 san Note Added: 0057391
2016-09-01 15:38 san Assigned To san => bugmaster
2016-09-01 15:38 san Status resolved => reviewed
2016-09-01 16:44 mkv Assigned To bugmaster => mkv
2016-09-01 17:26 git Note Added: 0057396
2016-09-02 13:21 mkv Note Added: 0057410
2016-09-02 13:22 mkv Note Added: 0057411
2016-09-02 13:22 mkv Note Added: 0057412
2016-09-02 13:22 mkv Assigned To mkv => rkv
2016-09-02 13:22 mkv Status reviewed => feedback
2016-09-02 13:22 mkv Test case number => bugs vis bug27567
2016-09-02 14:29 git Note Added: 0057417
2016-09-02 14:30 rkv Assigned To rkv => san
2016-09-02 14:30 rkv Status feedback => resolved
2016-09-02 14:30 rkv Steps to Reproduce Updated
2016-09-02 14:38 san Note Added: 0057423
2016-09-02 14:38 san Assigned To san => bugmaster
2016-09-02 14:38 san Status resolved => reviewed
2016-09-02 14:51 mkv Assigned To bugmaster => mkv
2016-09-02 15:36 git Note Added: 0057429
2016-09-05 19:32 mkv Note Added: 0057486
2016-09-05 19:33 mkv Note Added: 0057487
2016-09-05 19:33 mkv Assigned To mkv => rkv
2016-09-05 19:33 mkv Status reviewed => assigned
2016-09-06 15:41 git Note Added: 0057521
2016-09-06 15:42 rkv Assigned To rkv => san
2016-09-06 15:42 rkv Status assigned => resolved
2016-09-06 15:52 san Note Added: 0057522
2016-09-06 15:52 san Assigned To san => bugmaster
2016-09-06 15:52 san Status resolved => reviewed
2016-09-06 15:53 san Note Edited: 0057522
2016-09-06 15:58 mkv Assigned To bugmaster => mkv
2016-09-06 17:11 mkv Note Added: 0057527
2016-09-06 17:11 mkv Assigned To mkv => rkv
2016-09-06 17:11 mkv Status reviewed => assigned
2016-09-06 17:27 san Note Added: 0057529
2016-09-09 16:45 git Note Added: 0057648
2016-09-12 19:30 san Note Added: 0057707
2016-09-12 19:30 san Status assigned => feedback
2016-09-14 13:56 git Note Added: 0057778
2016-09-14 14:34 git Note Added: 0057783
2016-09-14 16:55 git Note Added: 0057792
2016-09-14 16:59 rkv Note Added: 0057793
2016-09-14 16:59 rkv Assigned To rkv => san
2016-09-14 16:59 rkv Status feedback => resolved
2016-09-14 19:13 san Assigned To san => rkv
2016-09-14 19:13 san Status resolved => assigned
2016-09-14 19:15 san Relationship added related to 0027734
2016-09-14 19:32 git Note Added: 0057804
2016-09-14 19:33 san Assigned To rkv => san
2016-09-14 19:33 san Status assigned => resolved
2016-09-14 19:38 san Note Added: 0057806
2016-09-14 19:38 san Assigned To san => bugmaster
2016-09-14 19:38 san Status resolved => reviewed
2016-09-15 10:50 mkv Assigned To bugmaster => mkv
2016-09-15 15:20 mkv Note Added: 0057823
2016-09-15 15:20 mkv Assigned To mkv => rkv
2016-09-15 15:20 mkv Status reviewed => feedback
2016-09-15 17:24 git Note Added: 0057830
2016-09-15 17:26 rkv Assigned To rkv => mkv
2016-09-15 17:50 mkv Status feedback => reviewed
2016-09-19 13:55 mkv Note Added: 0057920
2016-09-19 13:55 git Note Added: 0057921
2016-09-19 13:56 mkv Note Added: 0057922
2016-09-19 13:56 mkv Assigned To mkv => bugmaster
2016-09-19 13:56 mkv Status reviewed => tested
2016-09-23 10:21 bugmaster Changeset attached => occt master a2f76b15
2016-09-23 10:21 bugmaster Status tested => verified
2016-09-23 10:21 bugmaster Resolution open => fixed
2016-10-28 21:45 git Note Added: 0059495
2016-12-09 16:30 aiv Status verified => closed
2016-12-09 16:38 aiv Fixed in Version => 7.1.0