Juraj Misur opened SPR-9851 and commented
I have an app where I create many spring contexts for 3rd party classes, so they can autowire some resources, work in restricted environment, basically some "plugin system". These contexts are created and destroyed dynamically, sometimes in rapid pace.
Since I added support for custom javaconfig style context configuration, app started to produce PermGen errors. I traced it to the root of the problem, shown in this simple test:
package springctx;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
public class SpringCtxTest {
public static void main(String[] args) {
while (true) {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(MyConfigClass.class);
ctx.destroy();
}
}
}
Config class:
package springctx;
import org.springframework.context.annotation.Configuration;
@Configuration
public class MyConfigClass {
}
When I run this, I can see clearly in VisualVM that PermGen is heading to the sky. Heapdump revealed gazillion of springctx.MyConfigClass$$EnhancerByCGLIB$$5d91109e entries in CachedIntrospectionResults
When I run it without @Configuration annotation, everything is OK.
Affects: 3.1.1
Sub-tasks:
Issue Links:
Referenced from: commits 27c8371, ced6bb4, c806139
Juraj Misur opened SPR-9851 and commented
I have an app where I create many spring contexts for 3rd party classes, so they can autowire some resources, work in restricted environment, basically some "plugin system". These contexts are created and destroyed dynamically, sometimes in rapid pace.
Since I added support for custom javaconfig style context configuration, app started to produce PermGen errors. I traced it to the root of the problem, shown in this simple test:
Config class:
When I run this, I can see clearly in VisualVM that PermGen is heading to the sky. Heapdump revealed gazillion of springctx.MyConfigClass$$EnhancerByCGLIB$$5d91109e entries in CachedIntrospectionResults
When I run it without
@Configurationannotation, everything is OK.Affects: 3.1.1
Sub-tasks:
@Configurationbeans"Issue Links:
Referenced from: commits 27c8371, ced6bb4, c806139