Resource limitation issues in Windows Forms-based applications that are designed in Visual Studio 2005 or in Visual Studio .NET

INTRODUCTION
You may experience resource limitation issues in Microsoft Windows Forms-based a...

The .NET Framework 1.0 supports Windows 9 x-based operating systems to their limits. The .NET Framework 1.1 supports the Windows NT-based operating systems to their limits. However, the limits for the operating systems are different. Therefore, if you design and build a Windows Forms-based application on a Windows NT-based computer, and then you deploy and run the application on a Windows 9 x-based computer, the application may experience resource limitation issues.

When you stress-test these applications, you may receive the Win32 API "Error creating window handle" error message. Windows NT-based computers are limited to 10,000 Graphics Device Interface (GDI) handles per process. Windows 9 x-based computers are limited to only 1,200 GDI handles for the whole system. In some versions of Windows, the limit is 640 GDI handles, and all applications must share these GDI handles. For example, the Japanese version of Windows Millennium Edition has a limit of 640 GDI handles. This problem may also occur in unmanaged C language-based applications.

To minimize the effect of the resource limitations, use one or more of the following methods:
  • Make sure that you create only graphical controls that will be rendered. Fewer resources are available to applications when you allocate resources to hidden controls or to arrays of controls.
  • Be careful when you use graphical objects such as pens and brushes that allocate GDI handles. The .NET Framework 1.0 and the .NET Framework 1.1 do not always release their resources until the Dispose method is called.
  • Force garbage collection before new GDI objects are allocated. To force garbage collection, call the Dispose method for objects that you do not need. Later, you can call the GC.Collect method and the GC.WaitForPendingFinalizers method to force cleanup of those objects and to release those objects. We do not recommend this method for Windows NT-based systems. However, you may have to use this method to work around the resource limitations of the Windows 9x-based operating systems.
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值