Memory usage with Surface toolpath

Here's the place for discussion related to CAM/CNC and the development of the Path module.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Bendall
Posts: 41
Joined: Sat Oct 10, 2020 2:25 pm

Memory usage with Surface toolpath

Post by Bendall »

I used the surface toolpath for the first time yesterday and it looks like it isn't freeing the memory on each recompute. Memory usage goes up around 2000MB each time. Has anyone run into this or have any idea what to check. I built Freecad from source on Windows 10 and I am using the latest libpack. I'll attach the file if anyone wants to look at it. Thanks!

OS: Windows 10 Version 2004
Word size of FreeCAD: 64-bit
Version: 0.20.Unknown
Build type: Release
Python version: 3.8.6+
Qt version: 5.15.1
Coin version: 4.0.1
OCC version: 7.5.0
Locale: English/United States (en_US)
Brytech Touch Screen - Modification Op.FCStd
(800.86 KiB) Downloaded 46 times
bmsaus4ax
Posts: 258
Joined: Sat Nov 14, 2020 9:16 pm
Location: Bargara, Queensland, Australia UTC+10

Re: Memory usage with Surface toolpath

Post by bmsaus4ax »

Bendall wrote: Thu Apr 29, 2021 2:22 pm Has anyone run into this or have any idea what to check.
This happens on Ubuntu Linux as well. I find I have to shut FreeCAD down and restart to clear the memory.
It seems memory de-allocation is not being invoked correctly or is loosing track of the memory assigned location.
I have no solution though.


OS: Ubuntu 20.04.2 LTS (ubuntu:GNOME/ubuntu)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.24291 (Git) AppImage
Build type: Release
Branch: (HEAD detached at 0.19.2)
Hash: 7b5e18a0759de778b74d3a5c17eba9cb815035ac
Python version: 3.8.8
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.4.0
Locale: English/Australia (en_AU)
chrisb
Veteran
Posts: 54288
Joined: Tue Mar 17, 2015 9:14 am

Re: Memory usage with Surface toolpath

Post by chrisb »

I see the following sizes:
463124 initial size after loading the file
2586840 after first recompute of the whole file
3448448 after second recompute
4415892 after third recompute
4241956 after closing the file

Sketch009 contains an error, so no complete recompute can be performed. My guess is, that the cleanup is not performed due to the error state, and not the Path operation.
Can you fix the model and retry?

Related note: when I open the file I get an error message in Report view:

Code: Select all

No profile linked
Linked shape object is empty
Linked shape object is empty
<Exception> Linked shape object is empty
We have seen something similar recently: https://forum.freecadweb.org/viewtopic.php?f=3&t=58194

OS: macOS 10.16
Word size of FreeCAD: 64-bit
Version: 0.20.24720 (Git)
Build type: Release
Branch: master
Hash: 8b0c58d1b45017ad42bf0fa8f827f1cf22a398e7
Python version: 3.9.2
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.5.1
Locale: C/Default (C)
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Bendall
Posts: 41
Joined: Sat Oct 10, 2020 2:25 pm

Re: Memory usage with Surface toolpath

Post by Bendall »

My file didn't seem to have an error in Sketch009 so I don't know what happened for you. But the linked forum post was right I removed the hole features and the error when loading the file went away. It didn't make a difference about the memory usage though. I did see that I get the following error when recomputing the Surface toolpath:

07:54:38 <Path.Area> Area.cpp(1312): project failed
07:54:38 <Path.Area> Area.cpp(1614): skipped 1 sub shapes during projection
07:54:38 <Path.Area> Area.cpp(1672): Found 1 non coplanar shapes
07:54:38 PathSurfaceSupport.WARNING: getOffsetArea failed: 'bool' object has no attribute 'cut'; Using FindUnifiedRegions.
07:54:38 <Path.Area> Area.cpp(1432): hit bottom -0,0,1e-06
07:54:38 3D Surface operation time is 48.76989 sec.
chrisb
Veteran
Posts: 54288
Joined: Tue Mar 17, 2015 9:14 am

Re: Memory usage with Surface toolpath

Post by chrisb »

Bendall wrote: Fri Apr 30, 2021 12:00 pm My file didn't seem to have an error in Sketch009 so I don't know what happened for you.
This is then probably due to different OCC versions. I may have a look later.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
chrisb
Veteran
Posts: 54288
Joined: Tue Mar 17, 2015 9:14 am

Re: Memory usage with Surface toolpath

Post by chrisb »

I could "fix" the issue in Sketch009 by just removing all external geometry -leaving some degrees of freedom, but that's not relevant here. Besides some partially redundant constraints - which I always recommend to remove - there still is an error from Path workbench:

Code: Select all

<Path.Area> Area.cpp(1312): project failed
bmsaus4ax: your version is outdated, can you update to a recent one?
Bendall: I don't see a version number, did you compile yourself?

I would still like to see a confirmation on Bendall's issue with a current version and a try for a full recompute with OCC 7.5.1.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
bmsaus4ax
Posts: 258
Joined: Sat Nov 14, 2020 9:16 pm
Location: Bargara, Queensland, Australia UTC+10

Re: Memory usage with Surface toolpath

Post by bmsaus4ax »

chrisb wrote: Sat May 01, 2021 12:07 am
bmsaus4ax: your version is outdated, can you update to a recent one?

I would still like to see a confirmation on Bendall's issue with a current version and a try for a full recompute with OCC 7.5.1.
Tested on two versions as below.

The 0.19 version is reported as the latest by the in-program update.

OS: Ubuntu 20.04.2 LTS (ubuntu:GNOME/ubuntu)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.24291 (Git) AppImage
Build type: Release
Branch: (HEAD detached at 0.19.2)
Hash: 7b5e18a0759de778b74d3a5c17eba9cb815035ac
Python version: 3.8.8
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.4.0
Locale: English/Australia (en_AU)

Performed following sequence with accompanying Resource Monitor memory usage figures.
@ System idle, online, only resource monitor active 1.6GiB
@ FreeCAD open 1.7GiB
@ File open 1.8GiB
@ Recompute 4.7 GiB
@ Recompute again 5.5GiB
@ Close file without saving 5.5GiB
@ Reopen file 5.5GiB
@ Recompute again 8.3GiB
@ Run Simulation, successful no problems , completes ok 8.3GiB
@ Close file without saving 8.4Gib
@ Close FreeCAD 1.6GiB

Report view across whole process. all steps progressed unhindered regardless of warnings and faults.

Code: Select all

<Path.Area> Area.cpp(1312): project failed
PathSurfaceSupport.WARNING: getOffsetArea failed: 'bool' object has no attribute 'cut'; Using FindUnifiedRegions.
3D Surface operation time is 1 min. 0.75522 sec.
<Path.Area> Area.cpp(1312): project failed
PathSurfaceSupport.WARNING: getOffsetArea failed: 'bool' object has no attribute 'cut'; Using FindUnifiedRegions.
3D Surface operation time is 47.40604 sec.
<Path.Area> Area.cpp(1312): project failed
PathSurfaceSupport.WARNING: getOffsetArea failed: 'bool' object has no attribute 'cut'; Using FindUnifiedRegions.
3D Surface operation time is 1 min. 1.29014 sec.

Version 0.20, latest as reported from in-program update.

OS: Ubuntu 20.04.2 LTS (ubuntu:GNOME/ubuntu)
Word size of FreeCAD: 64-bit
Version: 0.20.24789 (Git) AppImage
Build type: Release
Branch: master
Hash: 31b0f25b6df1d1707fdf74135093831eec4f0281
Python version: 3.9.2
Qt version: 5.12.9
Coin version: 4.0.0
OCC version: 7.5.1
Locale: English/Australia (en_AU)


Performed following sequence with accompanying Resource Monitor memory usage figures.
@ System idle, online, only resource monitor active 1.6GiB
@ FreeCAD open 1.7GiB
@ File open 1.9GiB
@ Recompute 5.0GiB
@ Recompute again 5.8GiB
@ Close file without saving 4.6GiB (did drop slightly)
@ Reopen file 4.6GiB
@ Recompute again 6.7GiB
@ Run Simulation, successful no problems , completes ok 6.7GiB
@ Close file without saving 5.4Gib ( partial drop again)
@ Close FreeCAD 1.6GiB

Report view across whole process. all steps progressed unhindered regardless of warnings and faults.

Code: Select all

No profile linked
Linked shape object is empty
Linked shape object is empty
<Exception> Linked shape object is empty
<Path.Area> Area.cpp(1312): project failed
PathSurfaceSupport.WARNING: getOffsetArea failed: 'bool' object has no attribute 'cut'; Using FindUnifiedRegions.
3D Surface operation time is 1 min. 0.7522 sec.
<Path.Area> Area.cpp(1312): project failed
PathSurfaceSupport.WARNING: getOffsetArea failed: 'bool' object has no attribute 'cut'; Using FindUnifiedRegions.
3D Surface operation time is 46.91526 sec.
No profile linked
Linked shape object is empty
Linked shape object is empty
<Exception> Linked shape object is empty
<Path.Area> Area.cpp(1312): project failed
PathSurfaceSupport.WARNING: getOffsetArea failed: 'bool' object has no attribute 'cut'; Using FindUnifiedRegions.
3D Surface operation time is 1 min. 1.79336 sec.
chrisb
Veteran
Posts: 54288
Joined: Tue Mar 17, 2015 9:14 am

Re: Memory usage with Surface toolpath

Post by chrisb »

I have rebuild something similar concerning 3DSurface. The situation is by far not as severe as it seemed to be. The error messages come probably from the vertical surfaces which cannot be projected.

417324 size of FreeCAD after loading
418980 after first recompute
422468 2nd recompute
423532 3rd recompute
425016 4th recompute

429424 after closing the file (size has grown!)
436680 reopen same file
427044 1st recompute
429112 2nd recompute

Bendall, can you check if it is from the Path side what you want?
Bendall wrote: Thu Apr 29, 2021 2:22 pm
Attachments
Brytech_new_cb.FCStd
(23.71 KiB) Downloaded 39 times
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Bendall
Posts: 41
Joined: Sat Oct 10, 2020 2:25 pm

Re: Memory usage with Surface toolpath

Post by Bendall »

chrisb wrote: Mon May 03, 2021 11:19 pm Bendall, can you check if it is from the Path side what you want?
chrisb, that file seems to work great and it does not increase memory usage with each recompute. It must be something wrong with the model I was using. And it calculates a whole lot faster then before. I do still get the following errors in the report view but it seems to work fine.

10:12:05 <Path.Area> Area.cpp(1312): project failed
10:12:05 <Path.Area> Area.cpp(1614): skipped 1 sub shapes during projection
10:12:05 <Path.Area> Area.cpp(1672): Found 1 non coplanar shapes
10:12:05 PathSurfaceSupport.WARNING: getOffsetArea failed: 'bool' object has no attribute 'cut'; Using FindUnifiedRegions.

I'm not sure what was causing it but I did get my project completed. Ill see what happens on my next project and go from there. Thank you so much for looking into that for me!
chrisb
Veteran
Posts: 54288
Joined: Tue Mar 17, 2015 9:14 am

Re: Memory usage with Surface toolpath

Post by chrisb »

I think that these errors come from selecting vertical faces for the 3D surface tool. I didn't dig into a better selection, but I understand the message.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Post Reply