He Gregor,

I understand what you mean, but then still: in which way can this be
solved in a general and elegant way to "approach" the WeakReference
behavior in the JVM?

-- Ed

On Mar 25, 4:50 pm, gregor <[email protected]> wrote:
> Interesting question Ed.
>
> I read this:
>
> http://docstore.mik.ua/orelly/webprog/jscript/ch11_03.htm
>
> and a couple of other things. Looks like different browsers do things
> differently with javascript gc, with IE (surprise surprise) noticeably
> differing from the others.
>
> My feeling is that the JVM does this in Java basically and it's in the
> Java spec that it does, so you can rely on it. I don't think there is
> an equivalent javascipt spec for this behavior, so you probably cannot
> rely on this working, x-browser anyway, and you probably have to
> explicitly kill the listener yourself.
>
> On Mar 25, 2:59 pm, Ed <[email protected]> wrote:
>
> > He all,
>
> > Please a bit of advice on the following?
>
> > In Java you can use the WeakReference object to work with so called
> > weak Listeners. More details on this can be found here for 
> > example:http://www.javalobby.org/java/forums/t19468.html
> > or:http://www.ibm.com/developerworks/java/library/j-jtp11225/
>
> > I would love to do something similar but WeakReference isn't supported
> > in GWT. How do others deal with it ?
>
> > My problem: Suppose the following:
> > ViewCategory is created and adds a property listener to a global Model
> > to listen to Member name changes.
> > The view isn't needed anymore and as such his instance reference made
> > null in the controller where it's used.
> > The next time this view is needed, a new ViewCategory instance is
> > created, a listener is registered and the view is shown. We assume
> > that the old instance was garbage collected -> wrong assumption :(
> > Suppose that I forget to unregister the listener -> memory leak.....
> > The model keeps an association to the nested listener in the
> > ViewCategory instance such that this object and his nested objects
> > stay in memory.
>
> > Ofcourse you then say:" then clean this properly"... Yep... I do my
> > best, but in a complex situation with many requirements and things
> > going from left to right, it can happen that this is forgotten.
>
> > What would be nice:  weak listeners, like Swing has, such that when he
> > ViewCategory isn't associated anymore, it's removed and as such also
> > his listener from the global model.
>
> > How do I realize something like this ?
>
> > -- Ed
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to