View Issue Details

IDProjectCategoryView StatusLast Update
0001999FreeCADBugpublic2017-07-12 11:50
ReportersourcererAssigned Towmayer 
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
PlatformWindowsOSWindows 7OS Version7
Product Version0.14 
Target VersionFixed in Version0.17 
Summary0001999: [STEP] Tessellation data or OpenInventor data memory leak
DescriptionI tried to open the attached STEP file and wanted to convert it to a WRL file.
During opening it, after about a minute it usually crashes with an Out-of-Memory error
Steps To ReproduceOpen the file in FreeCAD
Wait a minute
Tagsmemory leak, STEP

Relationships

related to 0002480 closed File formats Opening big STEP file fail (slow tessellation of shapes) 

Activities

sourcerer

2015-03-11 20:47

reporter  

FreeCadProblem.step (Attachment missing)

wmayer

2015-03-11 21:15

administrator   ~0005858

Can you please post the complete version information of FreeCAD. You can do this under Help > FreeCAD > Copy to clipboard.

I tested with the current developer version and the old 0.14 and everything works fine.

OS: Windows 7
Word size: 64-bit
Version: 0.14.3700 (Git)
Branch: releases/FreeCAD-0-14
Hash: 32f5aae0a64333ec8d5d160dbc46e690510c8fe1
Python version: 2.7.6
Qt version: 4.8.5
Coin version: 4.0.0a
SoQt version: 1.6.0a
OCC version: 6.6.0

shoogen

2015-03-12 00:07

developer   ~0005860

Last edited: 2015-03-12 10:13

View 2 revisions

Werner perhaps you need to use a 32-bit platform ;)
VmPeak: 3192948 kB
Hm' my instance had leaked a lot before.
Today it was just VmPeak: 2769764 kB
But that is still a lot of memory.

sourcerer

2015-03-12 07:15

reporter   ~0005861

OS: Windows 7
Word size: 32-bit
Version: 0.14.3700 (Git)
Branch: releases/FreeCAD-0-14
Hash: 32f5aae0a64333ec8d5d160dbc46e690510c8fe1
Python version: 2.6.2
Qt version: 4.5.2
Coin version: 3.1.0
SoQt version: 1.4.1
OCC version: 6.5.1

shoogen

2015-03-12 09:43

developer   ~0005862

Last edited: 2015-03-12 09:54

View 2 revisions

If you got a 64-bit operating system you can solve this by installing the 64-bit version of FreeCAD.
The 32-bit platform can't provide the amount of VIRTUAL memory needed. (> 3GB)

sourcerer

2015-03-13 22:54

reporter   ~0005870

Unfortunately I only have a 32-bit platform available. Is it really necessary to have more than 3GB virtual memory just to open a 2 MB file? How much memory is needed for even larger files?
Also I have the feeling that there are memory leaks there, but it could be that that memory is still reuseable.

wmayer

2015-03-22 14:45

administrator   ~0005911

> Unfortunately I only have a 32-bit platform available.
I have tested this on a Linux 32-bit and Windows XP 32-bit inside a virtual machine and I can load the file.

> Is it really necessary to have more than 3GB virtual memory just to open a 2 MB file? How much memory is needed for even larger files?
It's a bit strange that the reader needs so much memory but I think this is more a problem of the complexity and less a problem of the file size.
> Also I have the feeling that there are memory leaks there, but it could be that that memory is still reuseable.
This all is done in OCC (the cad kernel) and it doesn't seem to be a leak there. The memory load goes down as soon as the object is loaded.

Kunda1

2017-01-11 12:14

administrator   ~0007623

@wmayer is this attached file a good example for finding memory leaks? Should we keep the file for tests?
Also should we keep this ticket open?

wmayer

2017-01-11 16:48

administrator   ~0007634

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

Kunda1

2017-01-13 22:45

administrator   ~0007740

Last edited: 2017-01-13 22:47

View 2 revisions

Tagged as 'memory leak'
downgraded to 'major'
Also renamed ticket for better comprehension

Kunda1

2017-01-19 19:29

administrator   ~0007885

Forum thread: https://forum.freecadweb.org/viewtopic.php?f=10&t=20059

wmayer

2017-02-18 14:55

administrator   ~0008350

A leak in the OpenInventor structure can be excluded as it destroys all the shape nodes.

Kunda1

2017-02-18 22:49

administrator   ~0008353

renamed topic for better precision

wmayer

2017-02-20 09:09

administrator   ~0008382

It turned out that when a shape was selected its reference counter was increased but never decreased later which causes the whole sub-graph not to be freed. git show 6630bcf now reduces the leak but there must be still somewhere another leak.

Kunda1

2017-04-25 11:56

administrator   ~0008751

Last edited: 2017-04-25 11:57

View 2 revisions

The below commits fix this issue, right @wmayer?
c:FreeCAD:a289538e034cac5f8f312b2945c41dc9fcd3e1c8:
c:FreeCAD:add9bf910bbb37c35738b01d38c7fe28b75fb8e3:

Bugtracker notes: if commits are not recognized by source-integration plugin then wait till they are then attach them to ticket and close.

Kunda1

2017-07-12 11:50

administrator   ~0009732

Source integration still doesn't see:
https://github.com/FreeCAD/FreeCAD/commit/a289538e034cac5f8f312b2945c41dc9fcd3e1c8
https://github.com/FreeCAD/FreeCAD/commit/add9bf910bbb37c35738b01d38c7fe28b75fb8e3

Closing anyway.

(CC @kkremitzki )

Related Changesets

FreeCAD: master 6630bcf9

2017-02-20 09:08:18

wmayer

Details Diff
issue 0001999: [STEP] Tessellation data or OpenInventor data memory leak Affected Issues
0001999
mod - src/Gui/SoFCUnifiedSelection.cpp Diff File

FreeCAD: releases/FreeCAD-0-16 f8eca0f9

2017-04-30 17:39:31

wmayer

Details Diff
fixes 1999: Tessellation data or OpenInventor data memory leak Affected Issues
0001999
mod - src/Mod/Import/App/AppImportPy.cpp Diff File
mod - src/Mod/Import/Gui/AppImportGuiPy.cpp Diff File

Issue History

Date Modified Username Field Change
2015-03-11 20:47 sourcerer New Issue
2015-03-11 20:47 sourcerer File Added: FreeCadProblem.step
2015-03-11 21:15 wmayer Note Added: 0005858
2015-03-12 00:07 shoogen Note Added: 0005860
2015-03-12 07:15 sourcerer Note Added: 0005861
2015-03-12 09:43 shoogen Note Added: 0005862
2015-03-12 09:54 shoogen Note Edited: 0005862 View Revisions
2015-03-12 10:13 shoogen Note Edited: 0005860 View Revisions
2015-03-13 22:54 sourcerer Note Added: 0005870
2015-03-22 14:45 wmayer Note Added: 0005911
2017-01-11 12:13 Kunda1 Tag Attached: STEP
2017-01-11 12:14 Kunda1 Note Added: 0007623
2017-01-11 16:48 wmayer Note Added: 0007634
2017-01-13 22:44 Kunda1 Tag Attached: memory leak
2017-01-13 22:45 Kunda1 Note Added: 0007740
2017-01-13 22:46 Kunda1 Severity crash => major
2017-01-13 22:46 Kunda1 Summary Opening a certain step file crashes FreeCAD => [STEP] Tessellation data or OpenInventor data memory leak
2017-01-13 22:47 Kunda1 Note Edited: 0007740 View Revisions
2017-01-19 19:29 Kunda1 Note Added: 0007885
2017-02-18 13:19 wmayer Assigned To => wmayer
2017-02-18 13:19 wmayer Status new => assigned
2017-02-18 14:55 wmayer Note Added: 0008350
2017-02-18 22:49 Kunda1 Summary [STEP] Tessellation data or OpenInventor data memory leak => [STEP] Tessellation data or OpenInventor data memory leak
2017-02-18 22:49 Kunda1 Note Added: 0008353
2017-02-20 09:06 wmayer Summary [STEP] Tessellation data or OpenInventor data memory leak => [STEP] Tessellation data or OpenInventor data memory leak
2017-02-20 09:08 wmayer Changeset attached => FreeCAD master 6630bcf9
2017-02-20 09:09 wmayer Note Added: 0008382
2017-03-02 16:47 Kunda1 Relationship added related to 0002480
2017-04-25 11:56 Kunda1 Status assigned => resolved
2017-04-25 11:56 Kunda1 Resolution open => fixed
2017-04-25 11:56 Kunda1 Fixed in Version => 0.17
2017-04-25 11:56 Kunda1 Note Added: 0008751
2017-04-25 11:57 Kunda1 Note Edited: 0008751 View Revisions
2017-07-12 11:43 Kunda1 Changeset attached => FreeCAD releases/FreeCAD-0-16 f8eca0f9
2017-07-12 11:50 Kunda1 Status resolved => closed
2017-07-12 11:50 Kunda1 Note Added: 0009732