| Shawn Pecze 2006-01-09, 11:10 pm |
| I have a Java application in which I would like to display the PerfMon
objects, instances and counters on a particular system. I have written some
JNI code to do this following the example outlined here
http://msdn.microsoft.com/library/d...
ames.asp
This works as expected on some windows systems, but it fails on others.
When it fails, my JVM crashes and the java core dump indicates an access
violation.
I've narrowed it down to the following line:
PerfCntr = NextCounter( PerfCntr );
in the else clause for when there are no instances for a particular object.
The one thing that is common on all of the systems where the code fails is
that there is at least one PerfMon object for which there are no instances or
counters defined. This is not the case on systems where the code works.
I've verified this by displaying the number of counters the object thinks it
has. On one particular system, although the object has no counters,
PerfObj->NumCounters returns 13.
Thus, I think that I'm incrementing the pointer right out of the buffer I've
allocated for the Perfmon data.
Is this a Windows bug? Or is there an additional check that isn't listed in
the example that I need to perform to make sure there are actually counters
defined for the object?
Thanks,
Shawn
|