Java EE application heap issue
We have used the eclipse memory analyzer and it shows the following things in the heap. The heap snapshot has been attached. Could this cause a开发者_JS百科 memory leak in the future?
I am not able to pin point which file exactly is causing so many objects to be retained on the heap. Can you please provide some insight on this? We are using a Java EE application with the spring framework along with a tomcat 5.5 server. The database used is mysql.
Thanks in advance.
The stack doesn't look particularly worrisome if you'd ask me.
The entries shown are created by the Spring framework and are used to increase its performance. Since Spring, like many other modern Java frameworks, uses reflection a lot to couple beans, inject stuff, apply configuration etc, it would be a little slow if all spring beans where inspected over and over again. Spring therefor caches the results of this inspection.
Also note that a WeakHashMap
is being used, which has special properties with respect to garbage collection (read its Javadocs to learn more about this).
The best way to find if you really have a memory leak is to comapre it at various levels: 1. take a heap memory snapshot once the application is started and no requests have been served. 2. Take multiple snapshots at various levels when requests are being served (in use application snapshot) 3. Take a snapshot after 3-4 min once all requests are processed.
If there is no memory leak 1 and 3 snapshots should be approximately same.
if they are not you can see which additional objects are occupying the memory. Start tracing from your custom packages rather than Spring or JDBC or core library packages.
精彩评论