log and track proxy creation in JVM

102 Views Asked by At

I have a class-loading problem in my app. We are using custom classloader and all is closed correctly but dynamic classes (com.sun.proxy.* and org.springframework.core.$Proxy) are generated pretty wildly and metaspace keeps growing to the point where JVM runs out of metaspace

I have tried a lot of things including heap and memory historgram analysis but I think I need some way to track proxy generation. I need to detect:

  1. which objects are creating proxies
  2. created proxy name

Is there any library / code snippet for that? I know I can technically use bytebuddy but dont want to reinvent the wheel

1

There are 1 best solutions below

0
On

Instead of using a Java agent, you should log the class loading via the -verbose:class flag and process this output.