Hi,
When running the Notepad-Demo shipped with the JDK on caciocavallo-web, I
noticed memory leaks caused by PropertyChangeListeners added to Actions
defined in DefaultEditorKit. Those actions are referenced by a static field
(defaultActions).
I was able to distill the problem down to the following testcase, is the
following code really supposed to leak memory:
while(true) {
final byte[] b = new byte[1000000];
new JTextArea().getActions()[0].addPropertyChangeListener(new
PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
b[0] = 0; //Listener will live forever, and so Objects
referenced from here
}
});
}
Thanks, Clemens