A few comments about the test:

1. "-mx10m" should be replaced with "-Xmx10M"

2. assertGC() can be implemented more reliably:

  List<int[]> l = new LinkedList<>();
  while (true) {
    try {
      l.add(new int[10000]);
    } catch (OutOfMemoryError e) {
      break;
    }
  }

After such a loop, GC is guaranteed to have collected all the dead objects.

Thanks,

Artem

On 12/25/2012 11:34 AM, Petr Pchelko wrote:
Hello.

Thank you for your feedback.

Here is the new version of the fix:
http://cr.openjdk.java.net/~art/pchelko/7079254/webrev.01/

Changes from the previous one:
        1. Added a test.
        2. Moved creadLightweightDispatcherOnRemove into a synchronized section.

Best, Petr.

On Dec 24, 2012, at 4:03 PM, Artem Ananiev wrote:

Hi, Petr,

the fix looks fine. Please, move clearLightweightDispatcherOnRemove() into the 
synchronized section, as lightweight dispatcher is used under tree lock.

As Sergey suggested, it would be fine to have a regression test for this change.

Thanks,

Artem

On 12/21/2012 4:50 PM, Petr Pchelko wrote:
Hello.

Could you please review the fix for the issue
7079254 Toolkit eventListener leaks memory
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7079254

The webrev is available at:
http://cr.openjdk.java.net/~art/pchelko/7079254/webrev/

The LightweightDispatcher stored strong references to mouseEventTarget and 
targetLastEntered which were not cleaned up when the component is removed, 
which lead to a memory leak. The isCleaned field is added to be able to consume 
events which would be dispatched to a removed component if we did not clean up 
a reference to it.

The fix testet on Windows and Mac on toy apps and automatic regression tests 
related to event dispatching, Component, Container, dnd and Mouse

Best, Petr.


Reply via email to