GDI Objects leak

VA Smalltalk is a "100% VisualAge compatible" IDE that includes the original VisualAge technology and the popular VA Assist and WidgetKit add-ons.

Moderators: Eric Clayberg, wembley, tc, Diane Engles, solveig

GDI Objects leak

Postby jgfoster » Tue Feb 19, 2008 5:31 am

I'm porting an application from VisualAge 6.0.2 to VA 7.5.2 and (among other things) have a GDI Objects leak. I'm on Windows Server 2003 R2 Standard Edition Service Pack 2 running Terminal Services (Remote Desktop). I'm running Windows Task Manager, viewing the Processes tab, and I have added the column "GDI Objects." When I launch VA, abt has just under 500 objects. As I run the application, the number of objects grows until GUI operations fail. This problem does not happen in the VisualAge environment. How might I go about debugging this problem?

James Foster
jgfoster
 
Posts: 5
Joined: Sun Feb 17, 2008 5:24 am

Re: GDI Objects leak

Postby jgfoster » Tue Feb 19, 2008 6:56 pm

I see that there was a fix in 7.5.1 for a GDI leak, but since we are on 7.5.2 I don't think this will help. I find that opening WindowBuilder and then closing it causes a leak of 2 objects. I created a basic window and threw a few widgets on it and then used the 'Test' button a few time. Each open/close caused a leak of 2 objects (I'm doing a full GC before recording the count). One of our moderately complex windows gets a leak of 22 objects each open/close on 7.5.2 (I tried on 6.0.2 and there is a leak of 4 objects for the same window). This problem is preventing our automated tests from getting even 10% of the way through. What is the next step in investigating this defect?

James Foster
jgfoster
 
Posts: 5
Joined: Sun Feb 17, 2008 5:24 am

Re: GDI Objects leak

Postby irccwh » Wed Feb 20, 2008 5:34 am

It's been a long time, so I don't remember the specifics, but I know in the past I've used gdileaks.exe from
http://msdn.microsoft.com/msdnmag/issues/03/01/GDILeaks/ and that article and it's predecessor http://msdn.microsoft.com/msdnmag/issues/01/03/leaks/default.aspx were helpful at least in figuring out what the GDI Objects were.

-Chad Hall
irccwh
 
Posts: 8
Joined: Thu Jan 25, 2007 10:13 am

Re: GDI Objects leak

Postby wembley » Wed Feb 20, 2008 9:25 am

James -

Do you get the leak only with windows developed using WindowBuilder or is it with all VA Smalltalk windows?
John O'Keefe [|], Principal Smalltalk Architect, Instantiations Inc.
wembley
Moderator
 
Posts: 405
Joined: Mon Oct 16, 2006 3:01 am
Location: Durham, NC

Re: GDI Objects leak

Postby jgfoster » Thu Feb 21, 2008 6:37 am

wembley wrote:James -

Do you get the leak only with windows developed using WindowBuilder or is it with all VA Smalltalk windows?


Hi John,

Opening the Application Manager, Config Maps Browser, Application Editions Browser, Applications Browser, and Classes Browser do not result in any GDI Objects being lost. I've created a sample WindowBuilder application that contains only one widget and leaks 8 GDI Objects each time it opens and closes. The code is appended to this reply.

James

Code: Select all
WbApplication subclass: #GdiObjectsLeak
    instanceVariableNames: ''
    classVariableNames: ''
    poolDictionaries: 'WkConstants EwConstants '


Code: Select all
addWidgets

   "Private: WARNING!!  This method was automatically generated by
    WindowBuilder Pro.  Code you add here which does not conform
    to the WindowBuilder Pro API will probably be lost the next time
    you save your layout definition."

   | aWkColumnarListBox |

   aWkColumnarListBox := WkColumnarListBox
      createWidget: 'aWkColumnarListBox'
      parent: self form
      argBlock: [:w | w
         x: 19;
         y: 13;
         width: 241;
         height: 161;
         scale].

   aWkColumnarListBox
      attachLeft: 19 relativeTo: XmATTACHFORM;
      attachTop: 13 relativeTo: XmATTACHFORM;
      yourself.


Code: Select all
setUpShell: aShell

   "Private: WARNING!!  This method was automatically generated by
    WindowBuilder Pro.  Code you add here which does not conform
    to the WindowBuilder Pro API will probably be lost the next time
    you save your layout definition."

   aShell
      x: 100;
      y: 100;
      width: 300;
      height: 200;
      fontExtent: 7 @ 16;
      title: 'Untitled';
      mwmDecorations: MWMDECORALL;
      yourself.
jgfoster
 
Posts: 5
Joined: Sun Feb 17, 2008 5:24 am

Re: GDI Objects leak

Postby wembley » Fri Feb 22, 2008 7:57 am

James -

I have confirmed the leak (thanks for the test code) and opened Case 34133. I'll ask Eric to look at it since he is most familiar with WindowBuilder.
John O'Keefe [|], Principal Smalltalk Architect, Instantiations Inc.
wembley
Moderator
 
Posts: 405
Joined: Mon Oct 16, 2006 3:01 am
Location: Durham, NC

Re: GDI Objects leak

Postby wembley » Tue Feb 26, 2008 2:17 pm

James -

Thanks to Chad Hall who posted above, I have now added GDILeaks to my tool collection and used it to find out what is happening. Your test app is leaking bitmaps -- 8 per iteration. They are the bitmaps used in WkColumnarListBox to expand/collapse the list. Now all I have to do is figure out where/why they are leaking and why they didn't in V6 :-(
John O'Keefe [|], Principal Smalltalk Architect, Instantiations Inc.
wembley
Moderator
 
Posts: 405
Joined: Mon Oct 16, 2006 3:01 am
Location: Durham, NC

Re: GDI Objects leak

Postby TheIconoclast » Wed Oct 15, 2008 6:24 am

Any word on this issue? GDI problems have become a recent hot topic for JWARS (a few users have been maxing out their GDI objects; I guess the app is too stable :D ), so we're working on shoring up whatever leaks we have. (I suspect that this is also a problem in WkHierarchicalListBox, which we use pretty heavily.)

Thanks,
Brian
TheIconoclast
 
Posts: 10
Joined: Tue Mar 06, 2007 11:51 am
Location: Northern VA

Re: GDI Objects leak

Postby wembley » Thu Oct 16, 2008 5:59 am

Brian -

Yes, this problem is fixed for V8.

What I have discovered is that there are several (actually, many) <something>IconManager classes in VA Smalltalk and its add-ons. They all appear to have been modelled on EpIconManager (used by the PackagerBrowser). So, they all (with the exception of EwxIconManager which got it right) exhibit the same leakage problem.

The right fix is to code one CgIconManager correctly and then use it in place of all the others. However, for the moment, I have just fixed WbIconManager and WkIconManager as a workaround for the problem.

The attached zip contains a manager with 2 apps -- WbApplicationFramework and WkControls. Load both of them and let me know if your problem is gone.
Attachments
case34133.zip
(827.21 KiB) Downloaded 84 times
John O'Keefe [|], Principal Smalltalk Architect, Instantiations Inc.
wembley
Moderator
 
Posts: 405
Joined: Mon Oct 16, 2006 3:01 am
Location: Durham, NC

Re: GDI Objects leak

Postby TheIconoclast » Fri Oct 17, 2008 3:58 am

John,

Excellent! Looks like that's going to take care of the vast majority of the problems.

Thanks for the help,
Brian
TheIconoclast
 
Posts: 10
Joined: Tue Mar 06, 2007 11:51 am
Location: Northern VA


Return to VA Smalltalk 7.0, 7.5 & 8.0

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest