Microsoft KB Archive/330203

= FIX: An application that uses MDI Child Forms and menus leaks Win32 resources =

Article ID: 330203

Article Last Modified on 10/11/2005

-

APPLIES TO


 * Microsoft .NET Framework 1.0
 * Microsoft .NET Framework Software Development Kit 1.0 Service Pack 2
 * Microsoft .NET Framework Software Development Kit 1.0 Service Pack 1
 * Microsoft .NET Framework Software Development Kit 1.0 Service Pack 2

-



This article was previously published under Q330203





SYMPTOMS
Microsoft Win32 resources that are used by Multiple Document Interface (MDI) Child Forms with menus are not returned to the operating system if the MDI Child Form is closed or is disposed of. This behavior only occurs if the time the application that uses MDI Child Forms terminates.



RESOLUTION
A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Only apply it to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, Microsoft recommends that you wait for the next Microsoft .NET Framework service pack that contains this hotfix.

To resolve this problem immediately, contact Microsoft Product Support Services to obtain the hotfix. For a complete list of Microsoft Product Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:

http://support.microsoft.com/contactus/?ws=support

Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

The English version of this hotfix has the file attributes (or later) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.

  Date         Time   Version       Size       File name -  04-Oct-2002  08:40  1.0.3705.365  1,179,648  system.data.dll 04-Oct-2002 08:35  1.0.3705.365  1,986,560  system.windows.forms.dll 03-Oct-2002 21:33                   16,688  system.windows.forms.ldo 03-Oct-2002 21:29  1.0.3705.365     57,344  system.windows.forms.tlb



Steps to reproduce the problem
 Create a Windows Application by using Microsoft Visual C# .NET. Add an MDI Child Form, and then set the value of the IsMdiContainer property to True in the Properties window. Add a Form that is named ChildForm, and then add five MainMenu controls to the ChildForm form. Add eight menu items to each MainMenu control. Add a MainMenu control with the following text to the MDI Child Form:

Test Menu Resource Leak

</li>  Add a menu item that is named menuItemCreateChilds with the text &quot;Create Child Windows&quot; to the MainMenu control that you added in step 5, and then add the following event handler: private void menuItemCreateChilds_Click(object sender, System.EventArgs e) { for(int i=0; i<20; i++) {                   ChildForm child = new ChildForm; child.MdiParent = this; child.Show; }       } </li>  Add a menu item that is named menuItemCloseChilds wth the text &quot;Close Child Windows&quot; to the MainMenu control that you added in step 5, and then add the following event handler: private void menuItemCloseChilds_Click(object sender, System.EventArgs e)        { while(MdiChildren.Length>0) {               MdiChildren[0].Close; MdiChildren[0].Dispose; }           GC.Collect; GC.WaitForPendingFinalizers; } </li> Open Windows Task Manager.</li> Click the Process tab</li> On the View menu, click Select Columns.</li> In the Select Columns dialog box, click to select the USER Objects check box, and then click OK to add the column to the process list.</li> In Visual Studio .NET, build and then run the Windows Application project.</li> Click Create Child Windows several times, and then click Close Child Windows several times. You will notice a large increase in the USER Objects of the application in Task Manager.</li></ol>

Keywords: kbbug kbfix kbqfe kbnetframe100presp3fix kbhotfixserver KB330203

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.