More Weird Behavior from the Draft WB: Memory Leak?

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
cflin
Posts: 56
Joined: Sun May 14, 2017 10:21 pm

More Weird Behavior from the Draft WB: Memory Leak?

Post by cflin »

Last year, I posted about the problem of snap points in the Draft WB (the don't work on multi-parts). However, in the most recent release of FC17 (as of Feb. 7, 2018), I observed the following:
  1. The snap points seem to work even on a multi-part if there is no Origin block (they still don't if there is an Origin block).
  2. I observed what seems to be a serious memory leak when I use the Draft WB. Although I did not put FC17 through valgrind or any other tool to verify this observation, I just know it's a memory leak because I start with a small file (only a couple of MB) and once I use the Draft WB a couple of times, the memory consumption of FC17 grows to over 11GB! I save the file, shut down FC17, restart it, re-import the same file, and the memory footprint of FC17 is negligible until I use the Draft WB again...
I am running the latest version of FC17, as I said, on 64-bit Ubuntu 16.04.3LTS.

It seems somebody is working on the Draft WB!
Last edited by cflin on Wed Feb 07, 2018 8:52 am, edited 1 time in total.
chrisb
Veteran
Posts: 53920
Joined: Tue Mar 17, 2015 9:14 am

Re: More Weird Behavior from the Draft WB

Post by chrisb »

cflin wrote: Wed Feb 07, 2018 8:36 am Last year, I posted about the problem of snap points in the Draft WB (the don't work on multi-parts). However, in the most recent release of FC17 (as of Feb. 7, 2018), I observed the following:
...

I observed what seems to be a serious memory leak when I use the Draft WB. Although I did not put FC17 through valgrind or any other tool to verify this observation, I just know it's a memory leak because I start with a small file (only a couple of MB) and once I use the Draft WB a couple of times, the memory consumption grows to over 11GB!
Can you please show your complete FreeCAD infos from the about dialog? It's important to know exactly which system you use. And can you please give a - preferably short - list of steps which clearly show the issue.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
cflin
Posts: 56
Joined: Sun May 14, 2017 10:21 pm

Re: More Weird Behavior from the Draft WB: Memory Leak?

Post by cflin »

Boy, this forum is very quick! I recalled my posting to add this info, and while I was doing that, you responded. I made some other changes to the HTML tags to improve readability.

Basically, I import an existing small file and then use the Draft WB. As it hunts for snap points, the memory footprint grows very rapidly. To reproduce the presumed fault, just invoke the dimensioning tool, hunt for a couple of snap points, release the dimensioning tool, and invoke it again. On my setup, each cycle of invocation of the dimensioning tool of the Draft WB increases the memory footprint of FC17 by many GB.

Here is what "About" says:

OS: Ubuntu 16.04.3 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.13217 (Git)
Build type: None
Branch: master
Hash: 89275766de909a5c1f36e962806dc7b4a0b0f47b
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0
Locale: English/UnitedStates (en_US)

Yes, it was dumb not to post system info the first time. But it is very late for me...
chrisb
Veteran
Posts: 53920
Joined: Tue Mar 17, 2015 9:14 am

Re: More Weird Behavior from the Draft WB: Memory Leak?

Post by chrisb »

I did the following:
- Start FreeCAD from console. (Output redirection of stderr to a file didn't work as expected, the counter was missing)
- Switch To Part
- new document
- Create Cube, leave default values
- switch manually to Draft, recompute(), switch to Part, recompute()
- process size at this moment: 196612
- execute the following in Python console:

Code: Select all

for i in range (1,1000):
  App.Console.PrintError(i)
  Gui.activateWorkbench("PartWorkbench")
  App.ActiveDocument.recompute()
  Gui.activateWorkbench("DraftWorkbench")
  App.ActiveDocument.recompute()
- while running I checked manually the process size, the biggest being 204604
- the output shows the following:

Code: Select all

maccb:Desktop cb$ FreeCAD.app/Contents/MacOS/FreeCAD
FreeCAD 0.17, Libs: 0.17R13217 (Git)
© Juergen Riegel, Werner Mayer, Yorik van Havre 2001-2018
  #####                 ####  ###   ####  
  #                    #      # #   #   # 
  #     ##  #### ####  #     #   #  #   # 
  ####  # # #  # #  #  #     #####  #   # 
  #     #   #### ####  #    #     # #   # 
  #     #   #    #     #    #     # #   #  ##  ##  ##
  #     #   #### ####   ### #     # ####   ##  ##  ##

Cannot find icon: cloneddollyRMv3
Cannot find icon: cloneddollyRM
Draft workbench activated
Draft workbench deactivated
Draft workbench activated
1Draft workbench deactivated
Draft workbench activated
2Draft workbench deactivated
Draft workbench activated
3Draft workbench deactivated
Draft workbench activated
4Draft workbench deactivated
Draft workbench activated
5Draft workbench deactivated
Draft workbench activated
6Draft workbench deactivated
Draft workbench activated
7Draft workbench deactivated
Draft workbench activated
8Draft workbench deactivated
Draft workbench activated
9Draft workbench deactivated
Draft workbench activated
10Draft workbench deactivated
Draft workbench activated
11Draft workbench deactivated
2018-02-07 11:13:26.580 FreeCAD[46903:5377730] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
2018-02-07 11:13:26.589 FreeCAD[46903:5377730] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
2018-02-07 11:13:26.599 FreeCAD[46903:5377730] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
2018-02-07 11:13:26.604 FreeCAD[46903:5377730] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
2018-02-07 11:13:26.609 FreeCAD[46903:5377730] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
2018-02-07 11:13:26.621 FreeCAD[46903:5377730] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
2018-02-07 11:13:26.626 FreeCAD[46903:5377730] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
Draft workbench activated
122018-02-07 11:13:26.803 FreeCAD[46903:5377730] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
2018-02-07 11:13:26.813 FreeCAD[46903:5377730] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
2018-02-07 11:13:26.826 FreeCAD[46903:5377730] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
2018-02-07 11:13:26.846 FreeCAD[46903:5377730] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
2018-02-07 11:13:26.860 FreeCAD[46903:5377730] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
2018-02-07 11:13:26.868 FreeCAD[46903:5377730] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
2018-02-07 11:13:26.878 FreeCAD[46903:5377730] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
2018-02-07 11:13:26.883 FreeCAD[46903:5377730] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
2018-02-07 11:13:26.888 FreeCAD[46903:5377730] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
Draft workbench deactivated
2018-02-07 11:13:26.949 FreeCAD[46903:5377730] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
2018-02-07 11:13:26.955 FreeCAD[46903:5377730] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
2018-02-07 11:13:26.958 FreeCAD[46903:5377730] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
2018-02-07 11:13:26.963 FreeCAD[46903:5377730] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
*** Abort *** an exception was raised, but no catch was found.
	... The exception is:SIGSEGV 'segmentation violation' detected. Address 0
A different test showed even some recoveries from exceptions but crashed in the end as well:

Code: Select all

Cannot find icon: cloneddollyRMv3
Cannot find icon: cloneddollyRM
Draft workbench activated
2Draft workbench deactivated
Draft workbench activated
3Draft workbench deactivated
Draft workbench activated
4Draft workbench deactivated
Draft workbench activated
5Draft workbench deactivated
Draft workbench activated
6Draft workbench deactivated
Draft workbench activated
7Draft workbench deactivated
Draft workbench activated
8Draft workbench deactivated
Draft workbench activated
9Draft workbench deactivated
Draft workbench activated
10Draft workbench deactivated
Draft workbench activated
11Draft workbench deactivated
Draft workbench activated
12Draft workbench deactivated
Draft workbench activated
13Draft workbench deactivated
Draft workbench activated
14Draft workbench deactivated
Draft workbench activated
15Draft workbench deactivated
Draft workbench activated
16Draft workbench deactivated
Draft workbench activated
17Draft workbench deactivated
Draft workbench activated
18Draft workbench deactivated
Draft workbench activated
19Draft workbench deactivated
Draft workbench activated
20Draft workbench deactivated
Draft workbench activated
21Draft workbench deactivated
Draft workbench activated
22Draft workbench deactivated
Draft workbench activated
23Draft workbench deactivated
Draft workbench activated
24Draft workbench deactivated
Draft workbench activated
25Draft workbench deactivated
Draft workbench activated
26Draft workbench deactivated
Draft workbench activated
27Draft workbench deactivated
2018-02-07 10:17:49.757 FreeCAD[1599:5052020] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
2018-02-07 10:17:49.761 FreeCAD[1599:5052020] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
2018-02-07 10:17:49.767 FreeCAD[1599:5052020] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
2018-02-07 10:17:49.771 FreeCAD[1599:5052020] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
2018-02-07 10:17:49.774 FreeCAD[1599:5052020] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
2018-02-07 10:17:49.781 FreeCAD[1599:5052020] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
2018-02-07 10:17:49.784 FreeCAD[1599:5052020] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
Draft workbench activated
282018-02-07 10:17:49.889 FreeCAD[1599:5052020] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
Draft workbench deactivated
Draft workbench activated
29Draft workbench deactivated
Draft workbench activated
30Draft workbench deactivated
Draft workbench activated
31Draft workbench deactivated
Draft workbench activated
32Draft workbench deactivated
Draft workbench activated
33Draft workbench deactivated
Draft workbench activated
34Draft workbench deactivated
Draft workbench activated
35Draft workbench deactivated
2018-02-07 10:17:51.844 FreeCAD[1599:5052020] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
2018-02-07 10:17:51.848 FreeCAD[1599:5052020] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
2018-02-07 10:17:51.855 FreeCAD[1599:5052020] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
2018-02-07 10:17:51.861 FreeCAD[1599:5052020] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
2018-02-07 10:17:51.865 FreeCAD[1599:5052020] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
2018-02-07 10:17:51.873 FreeCAD[1599:5052020] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
2018-02-07 10:17:51.876 FreeCAD[1599:5052020] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
Draft workbench activated
362018-02-07 10:17:51.979 FreeCAD[1599:5052020] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
Draft workbench deactivated
Draft workbench activated
37Draft workbench deactivated
Draft workbench activated
38Draft workbench deactivated
Draft workbench activated
39Draft workbench deactivated
Draft workbench activated
40Draft workbench deactivated
Draft workbench activated
41Draft workbench deactivated
Draft workbench activated
42Draft workbench deactivated
Draft workbench activated
43Draft workbench deactivated
Draft workbench activated
44Draft workbench deactivated
Draft workbench activated
45Draft workbench deactivated
Draft workbench activated
46Draft workbench deactivated
Draft workbench activated
47Draft workbench deactivated
Draft workbench activated
48Draft workbench deactivated
Draft workbench activated
49Draft workbench deactivated
Draft workbench activated
50Draft workbench deactivated
Draft workbench activated
51Draft workbench deactivated
Draft workbench activated
52Draft workbench deactivated
Draft workbench activated
53Draft workbench deactivated
Draft workbench activated
54Draft workbench deactivated
Draft workbench activated
55Draft workbench deactivated
Draft workbench activated
56Draft workbench deactivated
Draft workbench activated
57Draft workbench deactivated
Draft workbench activated
58Draft workbench deactivated
Draft workbench activated
59Draft workbench deactivated
Draft workbench activated
60Draft workbench deactivated
Draft workbench activated
61Draft workbench deactivated
Draft workbench activated
62Draft workbench deactivated
Draft workbench activated
63Draft workbench deactivated
Draft workbench activated
64Draft workbench deactivated
Draft workbench activated
65Draft workbench deactivated
Draft workbench activated
662018-02-07 10:18:00.901 FreeCAD[1599:5052020] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
2018-02-07 10:18:00.908 FreeCAD[1599:5052020] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
2018-02-07 10:18:00.916 FreeCAD[1599:5052020] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
2018-02-07 10:18:00.921 FreeCAD[1599:5052020] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
2018-02-07 10:18:00.924 FreeCAD[1599:5052020] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
2018-02-07 10:18:00.929 FreeCAD[1599:5052020] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
2018-02-07 10:18:00.932 FreeCAD[1599:5052020] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
2018-02-07 10:18:00.935 FreeCAD[1599:5052020] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
Draft workbench deactivated
2018-02-07 10:18:01.039 FreeCAD[1599:5052020] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
Draft workbench activated
67Draft workbench deactivated
Draft workbench activated
68Draft workbench deactivated
Draft workbench activated
69Draft workbench deactivated
Draft workbench activated
70Draft workbench deactivated
Draft workbench activated
71Draft workbench deactivated
Draft workbench activated
72Draft workbench deactivated
Draft workbench activated
73Draft workbench deactivated
Draft workbench activated
74Draft workbench deactivated
Draft workbench activated
75Draft workbench deactivated
Draft workbench activated
76Draft workbench deactivated
Draft workbench activated
77Draft workbench deactivated
Draft workbench activated
78Draft workbench deactivated
Draft workbench activated
79Draft workbench deactivated
Draft workbench activated
80Draft workbench deactivated
Draft workbench activated
81Draft workbench deactivated
Draft workbench activated
82Draft workbench deactivated
Draft workbench activated
83Draft workbench deactivated
Draft workbench activated
84Draft workbench deactivated
Draft workbench activated
85Draft workbench deactivated
Draft workbench activated
86Draft workbench deactivated
Draft workbench activated
872018-02-07 10:18:08.370 FreeCAD[1599:5052020] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
2018-02-07 10:18:08.376 FreeCAD[1599:5052020] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
2018-02-07 10:18:08.383 FreeCAD[1599:5052020] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
2018-02-07 10:18:08.386 FreeCAD[1599:5052020] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
2018-02-07 10:18:08.390 FreeCAD[1599:5052020] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
2018-02-07 10:18:08.395 FreeCAD[1599:5052020] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
2018-02-07 10:18:08.398 FreeCAD[1599:5052020] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
2018-02-07 10:18:08.402 FreeCAD[1599:5052020] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
Draft workbench deactivated
2018-02-07 10:18:08.516 FreeCAD[1599:5052020] *** Assertion failure in -[NSMenu insertItem:atIndex:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1561.20.106/Menus.subproj/NSMenu.m:725
Unhandled unknown exception caught in GUIApplication::notify.
*** Abort *** an exception was raised, but no catch was found.
	... The exception is:SIGSEGV 'segmentation violation' detected. Address 0
OS: Mac OS X
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.13217 (Git)
Build type: Release
Branch: (HEAD detached at 8927576)
Hash: 89275766de909a5c1f36e962806dc7b4a0b0f47b
Python version: 2.7.14
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.1.0
Locale: German/Germany (de_DE)
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
chrisb
Veteran
Posts: 53920
Joined: Tue Mar 17, 2015 9:14 am

Re: More Weird Behavior from the Draft WB: Memory Leak?

Post by chrisb »

Ubuntu works better, but the process size is increasing

I slightly simplified the test and did nothing but switching workbenches:

Code: Select all

for i in range (1,1000):
  App.Console.PrintError(i)
  Gui.activateWorkbench("PartWorkbench")
  Gui.activateWorkbench("DraftWorkbench")
The process size somehow corresponds with the number of double-switches:
500 switches yield a size of 536108
600 switches yield a size of ~ 590000
600 switches yield a size of ~ 590000
750 switches yield a size of ~ 622544

somewhere between 700 and 800 double switches it became very slow, almost 45 seconds for 10 double switches, the last 10 took almost a minute.
After the loop ended the process did nothing for quite a while at a size of 620336, FreeCAD was still not responding. Finally the GUI became active again, the process size stayed at 620336

OS: Ubuntu 16.04.3 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.13217 (Git)
Build type: None
Branch: master
Hash: 89275766de909a5c1f36e962806dc7b4a0b0f47b
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0
Locale: English/UnitedStates (en_US)
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
chrisb
Veteran
Posts: 53920
Joined: Tue Mar 17, 2015 9:14 am

Re: More Weird Behavior from the Draft WB: Memory Leak?

Post by chrisb »

There is something else peculiar with workbench switching: When I switch from PartDesign Workbench to some other Workbench the Python console tells
import PartDesignGui
on every switch away from PartDesign.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: More Weird Behavior from the Draft WB: Memory Leak?

Post by wmayer »

My observation with:
OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.13208 (Git)
Build type: Release
Branch: master
Hash: 1402e39ba0393d309f372f490ec77f1015be1c1a
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.0.0
Locale: German/Germany (de_DE)

I'm not sure if just loading the workbench causes the memory consumption reported by cflin. My test is as follows:
  1. Create a standard box in Part workbench
  2. Switch to Draft workbench. At this point I have a total size of 165 MB
  3. Activate the dimension command
  4. Do nothing but hovering over the box. You will see that the snap tool shows and hides some extra stuff in the 3d view
  5. After playing a while (e.g. 30 sec) the total size of consumed memory increased to 300 MB
I cannot confirm the huge number of 11GB but I can confirm almost doubled memory consumption after relative short time.
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: More Weird Behavior from the Draft WB: Memory Leak?

Post by wmayer »

chrisb wrote: Wed Feb 07, 2018 11:38 am There is something else peculiar with workbench switching: When I switch from PartDesign Workbench to some other Workbench the Python console tells
import PartDesignGui
on every switch away from PartDesign.
That's not a problem at all. Once the PartDesignGui module is loaded a second call is (more or less) a no-op.
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: More Weird Behavior from the Draft WB: Memory Leak?

Post by wmayer »

User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: More Weird Behavior from the Draft WB: Memory Leak?

Post by yorik »

Strange thing... Indeed it happens with all Draft tools (and Arch tools that depend on it too). The problem is very likely inside the snapping stuff. Also if there is no object in the document, the memory consumption still raises, but very slowly. If there is an object to hover on, memory consumption raises much faster.

Will do some more experiments, but very probably some stuff gets stored inside the Draft Snapper object, which stays existing over the whole freecad session...
Post Reply