[Fixed] Bug #1999: [STEP] Tessellation data or OpenInventor data memory leak

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
User avatar
Kunda1
Posts: 7010
Joined: Thu Jan 05, 2017 9:03 pm

[Fixed] Bug #1999: [STEP] Tessellation data or OpenInventor data memory leak

Postby Kunda1 » Thu Jan 19, 2017 7:28 pm

issue #1999: [STEP] Tessellation data or OpenInventor data memory leak
wmayer wrote: It looks like there is indeed somewhere a leak. However, I never had such an extreme peak of 3 GB. The highest load 600 MB when loading once.

Here are some (roughly measured) numbers:
* 120 MB after start of FreeCAD
* 150 MB directly after load of the STEP and before displaying it
* 500 MB after creating the tessellation mesh for the display
* 600 MB after doing some user interaction
* 540 MB after closing the document

When loading the file again it goes up to 750 MB and down to 690 MB after closing again. For every further load & close 150 MB - 200 MB are lost.

When loading the file in Python:
* 120 MB after start of FreeCAD
* 150 MB directly after load of the STEP and before displaying it
* 160 MB when creating a very coarse mesh
* 145 MB when deleting the object
* 160 MB when loading it again
* 230 MB when creating the tessellation mesh before displaying
* 300 MB when displaying the shape
* 280 MB when closing the document and deleting the shape

So, it looks like the tessellation data or the OpenInventor data are not freed.

Tested with:
OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.9590 (Git)
Build type: Release
Branch: master
Hash: a9530bc678b38902f5a68cd161ab27c0e36ff6f8
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.0.0
Last edited by Kunda1 on Mon Apr 03, 2017 9:32 pm, edited 1 time in total.
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
wmayer
Site Admin
Posts: 15471
Joined: Thu Feb 19, 2009 10:32 am

Re: Bug #1999: [STEP] Tessellation data or OpenInventor data memory leak

Postby wmayer » Mon Apr 03, 2017 4:26 pm

One needs to explicitly close the OCAF document in order to free all data. It is briefly described in Roman Lygin's blog: http://opencascade.blogspot.de/2009/03/ ... art-1.html

See git commit a289538