Bug #46101 MySQL Workbench OSS leaks GDI objects, resulting in massive performance drops
Submitted: 9 Jul 2009 20:49 Modified: 28 Aug 2009 10:11
Reporter: Christian Walde Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Workbench Severity:S2 (Serious)
Version:5.1.16 OSS OS:Windows (XP SP2)
Assigned to: Mike Lischke CPU Architecture:Any
Tags: CHECKED, gdi, Leak, performance

[9 Jul 2009 20:49] Christian Walde
Description:
In advance, definition of my use of the word leak: Similar as in memory leaks, an application allocates a resource without freeing it when appropriate, resulting in performance or even functionality loss over time. Speed of increase of allocation dependent on application use.

GDI objects are resources created by Windows applications in order to render GUI elements. Extreme levels of use in an application are GDI object counts of ~2000 (for example in web browser Opera when using 100+ tabs).

Excessive use of these can lead to not only performance drops in the application itself and also lead to adverse effects on other applications, for example inability of applications to even start due to lack of system resources, even when enough memory would be available.

How to repeat:
1. Download and install Microsoft Technet Process Explorer: http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx

2. In Process Explorer, enable display of GDI Object count column by right-clicking the columns, choosing the "Select columns" option and checking the "GDI Objects" checkbox in the "Process Memory" tab.

3. Open Workbench and load any project with 5 or more tables or create a new one. Make sure an EER Diagram is present and open.

4. Double-Click each table to load their edit form once. (Might be optional.)

5. Switch back and forth repeatedly between the tabs "MySQL Model" and "EER Diagram", while ProcExp window is visible.

6. Observe how GDI Object count rises with each switch and does not drop even after application has not received activity for a while.

Suggested fix:
Review GUI rendering code and ensure that allocated GDI objects are freed once they are not in use anymore or alternatively re-used as applicable.
[9 Jul 2009 21:58] MySQL Verification Team
Thank you for the bug report. Could you please try with latest release 5.1.16 and comment the result. Thanks in advance.
[9 Jul 2009 22:55] Christian Walde
Just installed that and it behaves identical in the described aspects. Details above updated to reflect that. Thanks for the quick answer. :)
[13 Jul 2009 12:25] MySQL Verification Team
Thank you for the feedback. Verified as described.
[7 Aug 2009 8:35] Mike Lischke
Fixed in 5.1 and 5.2
[14 Aug 2009 8:51] Mike Lischke
After some investigation it turned out that the increase in GDI object usage everytime there's a switch between pages (overview, models) results from a leak in the ToolStripTextBox control from the .NET framework (used as searchbox in the toolbar).

Currently all the toolbars are recreated when the user switches between pages, which can be optimized. However this is a task not in the context of this bug report. Hence it can be closed.
[14 Aug 2009 15:02] Johannes Taxacher
improved handling of GDI objects.
fix is included in 5.1.17
[28 Aug 2009 10:11] Tony Bedford
An entry was added to the 5.1.17 changelog:

The Microsoft Windows version of MySQL Workbench leaked GDI objects, resulting in a drop in performance.