fredsa / gwt-dnd

Library providing easy to use mouse or touch based drag-and-drop capabilities to GWT
43 stars 41 forks source link

AbstractDragController possible memory leak #70

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What version of GWT are you using? 1.3.3? 1.4.60? Other?
1.6.4
What version of the gwt-dnd jar file or library file are you using?
2.6.2
What operating system(s) are you using? Windows? Linux? Mac?
Linux
Does the issue occur in web mode, hosted mode, both or don't know?
hosted mode (not tested on web mode)
What browser(s) do you use? Firefox, IE, Safari, other?
Gecko based
What is the browser version (if you know) from Help->About?
-

Hi Fred,

there is a cyclic reference between AnstractDragController and DragContext.

The workaround that works for me is to remove 'final' from (in
AnstractDragController.java):

  /**
   * The drag controller's drag context.
   */
  protected DragContext context;

and in my WindowPanel code my custom drag controller's constructor looks
like this:

    public MoveDragController(AbsolutePanel boundaryPanel) {
      super(boundaryPanel);

      WindowPanel.this.addWindowCloseListener(new WindowCloseListener() {
        public void onWindowClosed() {
          MoveDragController.this.context = null;
        }

        public String onWindowClosing() {
          return null;
        }
      });
    }

Kind Regards,
George.

Original issue reported on code.google.com by georgopo...@gmail.com on 19 May 2009 at 11:50

GoogleCodeExporter commented 9 years ago
Thanks George.

Can you help me understand where the memory leak occurs or what other problems 
you see with the cyclic reference? Are you able to visualize a memory leak some 
how?

Original comment by fredsa on 12 Jul 2009 at 4:30

GoogleCodeExporter commented 9 years ago
I changed my code and use one drag controller per desktop panel and not per 
window. I
am going to make some more tests (I was using http://www.eclipse.org/mat/ in 
hosted
mode for the tests) with an older version of WindowPanel and send you the 
results.

That issue was part of http://code.google.com/p/gwt-mosaic/issues/detail?id=51 
in
gwt-mosaic.

Thanks
George.

Original comment by georgopo...@gmail.com on 14 Jul 2009 at 10:16

GoogleCodeExporter commented 9 years ago
Note that memory footprint growth is not necessarily an indication of a memory 
leak - 
at least not in the presence of garbage collection.

Generally, I've not seen any memory leaks with JavaScript objects only 
referring to 
other JavaScript objects. The problem tends to occur with DOM/JavaScript 
references. I 
useful reference is this one http://code.google.com/p/google-web-
toolkit/wiki/DomEventsAndMemoryLeaks

Original comment by fredsa on 16 Jul 2009 at 10:15

GoogleCodeExporter commented 9 years ago
Hi,

yes cyclic references only in Java/JS code does not leak memory. WindowPanel 
was too
complex now its simplified and there is no problem with the drag controller. I 
am to
do some more tests after I am back from holidays.

Thank you very much for your help.

Kind Regards,
George.

Original comment by georgopo...@gmail.com on 17 Jul 2009 at 3:27

GoogleCodeExporter commented 9 years ago
Thanks

Original comment by fredsa on 27 Jul 2009 at 2:18