Hello,
I've encounter a leak of 50 handles, when trying to query performance
counters through the registry using HKEY_PERFORMANCE_DATA registry
key.
I've found out that when netfxperf.dll is enabled (.NET dll that used
for .NET performance counters) the leak occurs.
When I disable that performance counters (through exctrlst in the
resrouce kit, uncheck the .NET CLR data, .NET CLR networking
counters), the leak stops.
Here is a small code fragment that demonstrate the problem:
void test(void)
{
long return_value = 0;
DWORD buffersize = (sizeof(PERF_DATA_BLOCK)+
sizeof(PERF_OBJECT_TYPE)),
type = REG_EXPAND_SZ;
PPERF_DATA_BLOCK perfdata = NULL;
perfdata = (PPERF_DATA_BLOCK) malloc(buffersize);
memset(perfdata,0,buffersize);
RegQueryValueEx( HKEY_PERFORMANCE_DATA,
"Global",
NULL,
&type,
(LPBYTE) perfdata,
&buffersize );
RegCloseKey(HKEY_PERFORMANCE_DATA);
free(perfdata);
}
Does anyone have an idea if I'm doing something wrong?
It seems to me like a bug in .NET netfxperf.dll but I did nto find
any documentation for such bug.
Thanks,
Yair