You have to call DOM.setEventListener(elt, null) whenever "elt" is
detached from the document (that's what Widget.onDetach does) or at
least at "unload" time (RootPanels are detached at on unload, and thus
detach their children in cascade; same goes for widgets created with
their static wrap() method, as they automatically register themselves
for RootPanel.detachOnWindowClose).
Actually, you'd rather create a Widget and follow the static
wrap(Element) pattern found on other widgets (Button, TextBox, etc.)
than directly play with DOM.setEventListener. Or just be careful to
reset event listeners to "null" before "unload" for each element
you've attached a listener to.
> Is it possible to have memory leak when using DOM.getElementAttribute
> or DOM.getParent for example ?
I don't think so. Actually, memory leaks are mostly caused by DOM
elements referencing javascript objects referencing back the DOM
element (which is easily done when attaching events in "pure
JavaScript"). You shouldn't suffer from memory leaks with GWT except
if you start playing with DOM.setEventListener and/or JSNI.
That being said, I'm not a JavaScript expert wrt memory leaks, so
you'd better check before taking my word for it :-P