View Issue Details

IDProjectCategoryView StatusLast Update
0021142Open CASCADEOCCT:Samplespublic2021-09-20 10:26
Reporterszy Assigned Toabv  
Status feedbackResolutionopen 
Product Version6.7.0 
Target Version7.7.0 
Summary0021142: Memory leaks using standard OCCT samples
DescriptionMinor problem with memory management in OCCT selection logic & sufficient
problems in MFC-based sample GUI(TopologyPrimitives).
Customer description:
"I clicked on Box repeatedly and task manager showed memory increasing with each
click. Also when I clicked through all the options memory kept increasing
continuously. If I understand Memory optimization correctly, then application
should not allocate new memory block with each click on same icon but should use
memory from free list. Same is the problem with import-export sample when I keep
on importing same file and close the window repeatedly. This increases the
memory continuously. This is true with and without memory optimization i.e.
MMGT_OPT= 1 and 0 respectively."

OCN expert (SAN) analysis report:
"Here some new analysis results based on TopologicalPrimitives sample:
- When an AIS_Shape instance is removed from the interactive context, and this
is not the presentation that has been highlighted with the mouse most recently,
both the AIS_Shape and the underlying TopoDS_TShape are correctly destroyed
after removing.
- When an AIS_Shape instance is removed from the interactive context, and this
is the presentation that has been highlighted with the mouse most recently, the
AIS_Shape instance is destroyed but the underlying TopoDS_TShape is not, due to
one reference kept inside OCCT selection mechanism (something like "last
highlighted entity owner"). However, this last reference is freed when the user
highlights something in the viewer again.
- Re-creating primitives in the sample multiple times do not lead to virtual
memory growth on my workstation.

Thus my conclusion is as follows:
there is a minor problem with memory management in OCCT selection logic, but it
is unlikely to result in significant memory leaks. The memory leaks reported by
the customer are therefore located somewhere outside OCCT visualization,
probably somewhere in MFC-based sample GUI. Visual Studio debugger reports
memory leaks even if the sample is started and then closed immediately without
any user actions."
TagsNo tags attached.
Test case number


related to 0020627 closedepa Memory leaks in BRepMesh 



2013-12-12 11:17

developer   ~0027180

Dear apn,

Can you please try to import and close the same CAD model multiple times (10-20), according to the initial complaint of the customer, and check if there is any memory growth, according to Windows task manager?


2013-12-17 12:58

administrator   ~0027230

Import (new Document - Import STEP) and closing (Close current Document) the same CAD model multiple time in ImportExport MFC Sample lead to memory growth (can be seen in Windows Task Manager).


2016-11-09 11:31

manager   ~0060081

Sergey, please check current status of this issue (repeat the test reported in the last note)


2016-11-09 17:15

developer   ~0060132

Dear abv,

I have checked mfc ImportExport sample from current state of master with next scenario:
step 1: run the sample
step 2: new Document
step 3: import STEP/BREP shape
step 4: File -> Close
step 5: repeat steps 2-4 several time (10)

Result: windows task manager shows grown of memory allocated by the sample. (from 21K to 113K for 10 repeats in my case)


2016-11-09 17:17

developer   ~0060133

Note that shape was the same for all 10 repeats.
I have tried with both STEP and BREP formats.


2018-02-08 19:02

manager   ~0073891

Attempt to open STEP file CraneASM.stp (from GrabCAD) kills Qt ImportExport sample in OCCT 7.2.0. MFC ImportExport sample shows the model but dies upon closing the document window.

Issue History

Date Modified Username Field Change
2009-05-29 19:03 szy CC => INV
2009-06-09 16:21 san CC => abv
2009-06-09 16:22 san CC => szy
2009-06-09 16:43 szy CC => san
2011-08-02 11:24 bugmaster Category OCCT:VIZ => OCCT:Visualization
2012-10-26 10:01 szy Assigned To bugmaster => san
2012-10-26 10:01 szy Status new => assigned
2012-10-26 10:01 szy Fixed in Version EMPTY =>
2012-10-26 10:01 szy Target Version => 6.6.0
2012-10-26 10:01 szy Description Updated
2013-02-26 18:20 san Target Version 6.6.0 => 6.7.0
2013-12-12 11:13 san Relationship added related to 0020627
2013-12-12 11:17 san Note Added: 0027180
2013-12-12 11:17 san Assigned To san => apn
2013-12-12 11:17 san Status assigned => feedback
2013-12-17 11:28 san Status feedback => assigned
2013-12-17 11:28 san Category OCCT:Visualization => OCCT Release:MFC
2013-12-17 11:28 san Summary Memory leaks using standard sample TopologyPrimitives => Memory leaks using standard OCCT samples
2013-12-17 12:58 apn Note Added: 0027230
2013-12-17 12:58 apn Assigned To apn => san
2013-12-17 12:58 apn Product Version => 6.7.0
2013-12-17 12:58 apn Target Version 6.7.0 => 6.7.1
2014-01-11 11:59 abv Category OCCT Release:MFC => OCCT Release:Samples
2014-01-11 12:02 abv Category OCCT Release:Samples => OCCT:Samples
2014-04-04 18:32 abv Target Version 6.7.1 => 6.8.0
2014-09-26 11:05 abv Target Version 6.8.0 => 7.1.0
2016-11-09 11:31 abv Note Added: 0060081
2016-11-09 11:31 abv Assigned To san => ski
2016-11-09 11:31 abv Status assigned => feedback
2016-11-09 17:15 ski Note Added: 0060132
2016-11-09 17:15 ski Assigned To ski => abv
2016-11-09 17:17 ski Note Added: 0060133
2016-11-09 17:40 abv Target Version 7.1.0 => 7.2.0
2017-08-15 12:59 abv Target Version 7.2.0 => 7.4.0
2018-02-08 19:02 abv Note Added: 0073891
2019-07-19 19:23 apn Target Version 7.4.0 => 7.5.0
2020-09-11 16:45 utverdov Target Version 7.5.0 => 7.6.0
2021-09-20 10:26 kgv Target Version 7.6.0 => 7.7.0