While trying to reproduce a reported problem with a managed nt-service, I've noticed that the performance counter "# of Methods Jitted" is constantly increasing (together with "# of IL Bytes Jitted"). The reported behavior consists of taking alot of memory (not necessarily everything available on the machine) and consuming 100% cpu. Requests to this nt-service (via wcf) often results in timeouts, ie 90+ seconds. (The requests originates from an asp.net site on the same machine.)
After 15 minute warmup time the value was 127k (3610 kb), and 246k (6427 kb) after an hour has elapsed, ie an increase of 119k jitted methods.
I do not think that it is this behavior alone that's causing the reported problem because the reported runtime before the service goes havoc is just a few hours.
However, I am still interested in how to interpreted this [apparently] ever-increasing number. While it's only 3 mb per hour, it will be 500 mb per week. And also, anyone know if the "# of IL Bytes Jitted" is subject of garbage collection?
(During the 20 minutes taken to write this post the number of methods has increased by 33k, and number of bytes with ~300k.)
Clarifications
Things that I should have mentioned the first time... ;)
- We have no code that creates, loads or unloads any appdomains.
- We're not emitting anything, and using C# 3, so no dynamic objects.
- We're using NHibernate and AutoMapper, both using reflection to solve their goals. However, I presume that those libraries behave well and wont cause this behavior. (Any tool out there that allows me to see what methods are jitted?)
Changes
- Removes the comparison between number of code lines and number of jitted methods. As Oded points out, the counter also includes methods within the .NET Framework.