Archived issue #0021142
Memory leaks using standard OCCT samples
Description
Minor 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."
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."
Public activity
6 archived notes
Participants are labeled by their role within this record.
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?
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?
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).
Sergey, please check current status of this issue (repeat the test reported in the last note)
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)
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)
Note that shape was the same for all 10 repeats.
I have tried with both STEP and BREP formats.
I have tried with both STEP and BREP formats.
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.
Related records