Hi Roman,

You keep creating and adding new listeners without ever removing them.
> Of course this is going to leak.


What makes me wonder, I add the listeners to an Action from a newly created
JTextArea.
Shouldn't the action belong to the JTextArea itself and be garbage-collected
too when the JTextArea is no longer reachable? (like its the case for
Listeners attached to the Component directly like Mouse/Key/...-Listeners)
In the case of Notepad, that would mean Swing would require the application
to remove the listeners manually?

I have to admit I don't understand the concept of Actions in detail...



> It's not even related to the fact that
> the listener references the array (although that could play a role in
> more complicated leaking scenarios)
>

Sure, the array is just there to trigger the OOM faster ;).


Thanks, Clemens

Reply via email to