so just to understand just replace anonymous in call callback with a
variable will fix the problem ?
instead of:
call(new callback(){});

use :
callback c = new callback(){};
call(c);

?



On Sep 26, 1:29 pm, Rokesh <rjan...@gmail.com> wrote:
> Hi All,
>
> I've been working on GWT for a while now and noticed something important and
> peculiar.
> In GWT you code in Java and almost automatically assume Java garbage
> collection (because that's how you code).
>
> In this code 
> sample:http://code.google.com/webtoolkit/doc/latest/DevGuideServerCommunicat...
> you'll see that the callback is created like the code snippet below. I
> imagine that every GWT project will implement it like this.
>
> The Use Case: Fill data in the new CellTable widget. The size of the data
> varied from 100 to 600 records.
>
> If the onSuccess results in a lot of data and this event/callback is invoked
> lots of times (actually 3 to 5 times is enough) , on IE6, IE7,IE8 and IE9
> there will be performance degradation. In other browsers
> like Chrome, Firefox and Safari there is no performance loss noticed.
>
> After reading Joel Webber's note on Performance, I found out that it's not
> the component (like the CellTable) that causes this behavior,
> but it was the callback creation. It seems that IE doesn't know how to
> garbage collection the "callback". So each time this "new AsyncCallback" is
> performed,
> a memory leak occurred in IE browsers.
>
> Since the Callback is stateless, we decided to create the callback only once
>  (*static *variable) and there was no performance loss anymore.
> After clicking for a while, the performance was the same (even after
> inspecting the results of  some measurement tools).
>
> This worked for us and even IE6 is blazingly fast. IE9 is now even faster
> that Chrome! No need for Chrome Frame Plugin (some organizations don't allow
> Plugins at all, think about that!)
>
> Hopefully this tip works for you.
>
> And Yes we have GWT in production. That company's browser policy is to use
> IE (now on 7, moving to 8). So this had to work or otherwise , it was a huge
> showstopper!
>
> GWT applications do perform (even in older browsers), just make sure that
> critical parts of your code are carefully reviewed (especially on the
> "new").
>
>  AsyncCallback callback = new AsyncCallback() {
>     public void onSuccess(Void result) {
>       // do some UI stuff to show success
>     }
>
>     public void onFailure(Throwable caught) {
>       // do some UI stuff to show failure
>     }
>   };
>
>   // (3) Make the call.......

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to