Hi have a vaadin 7 / spring 3 application which leaks memory massively.
The application is used by <500 users and needs about 30GB memory over the day. I collected multiple heap dumps and histogramms. I had some very strange observations. Since I kindof inherited this application I don't know if it is written correctly, so I can only guess.
1) After 3 hours running I have
627 instances of MyApplication (extends UI)
420 instances of VaadinSession
but
3296 AnnotationConfigApplicationContext
most of the Context instances are closed, but still there and have all the beans. But now the weirdest part of all. In my loadProtectedResources method (on authenticate and init) I create a new instance of of config and close them in the close() method. But my histogram show me, that I have 8134 instances of my AppConfig$$FastClassByCGLIB$$53bafb34 with further 581 classes not instances of my AppConfig with 14 instances each:
AppConfig$$EnhancerByCGLIB$$279c5c96$$FastClassByCGLIB$$40135d4c
(the number in the back changes)
and further 285 classes with one instance each:
AppConfig$$EnhancerByCGLIB$$af5a0160
The classes that are used or imported by AppConfig are also there, so my vm contains about 20K classes which could explain where all the memory go...
In understand that those classes are created on the fly but not why they are not collected. What could I (or the previous developer) make wrong to leave the classes un-collectable in memory.