I'm currently investigating a memory leak in one of our applications. After further investigation, I came up with a
test of two simple
java swing applications that sit idle for almost 14 hours. Both applications consist of 30 JButtons.
The 1st application is using a strong reference for its action listener:
The 2nd application is using a weak reference for its action listener:
Here's the WeakActionListener implementation:
I profile both applications using JConsole for 14 hours. I just leave them idle for that time frame. It shows that both applications either using weak reference or strong reference have an increasing memory heap consumption over time.
My question is, is this a bug in Java Swing API? What are the other alternatives in resolving this kind of memory leak?
Thanks in advance!