大网数据广告活动
Web服务器与PHP

Event handles may leak

· 52CE 我爱测

This article provides resolutions for the problem where ASP_PERFMON_- [XX] event handles may leak when you query performance counter objects on a local computer.

This article helps you resolve the problem where ASP_PERFMON_- [XX] event handles may leak when you query performance counter objects on a local computer.

Original product version:   Internet Information Services
Original KB number:   2962962

Symptoms

When you read performance monitor objects on your local computer by using the PDHEnumObjects API together with the bRefresh parameter set to true, you may notice a leak of ASP_PERFMON_-[XXX] event handles. This leak can also be observed if you query performance counter objects in .NET code by using System.Diagnostics.PerformanceCounter and you make a call to the System.Diagnostics.PerformanceCounter.CloseSharedResources() method.

Cause

This leak occurs when the application code continuously closes and recreates the ASP performance counter object.

Workaround

To work around this issue, use one of the following methods:

  • Instead of closing and reopening the ASP performance counter object repeatedly, create a global instance of the ASP performance counter object, and then have your code read values from this global instance.
  • If you do not intend to query the ASP performance counter object, you may disable it by adding a Disable Performance Counters DWORD registry entry that has a value of 1 to the registry subkey: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\ASP\Performance.

Source: Microsoft Learn / IT Pro troubleshooting by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / IT Pro troubleshooting
适用范围
See source applicability · Source date 12/11/2020
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。