I could see in my application that no of loaded classes keeps on increasing as discussed here.
On using yourkit and help from the stack overflow community ,I was able to conclude that the classes getting increased is because of the reflection classes getting dynamically created as listed below:
- GeneratedConstructorAccessorXX
- GeneratedMethodAccessorXX
GeneratedSerializationConstructorAccessorXX
where XX is some number.
As per my knowledge and what I have come to know after googling, These are kind of runtime proxies used by reflection to access object information which is stored in the memory.These accessors are cached so that they dont have to be regenerated each time. These class objects are singleton per classloader, and hence we have only one instance of a generated accessor per classloader of a given Class. If this is the case,why I see the increase of loaded classes when I am running the repeat test.
Update* On further analysis I have observed that increased load is specifically because of GeneratedSerializationConstructorAccessor.