that widgets are expensive to create and it is much better to keep and
resume them. For more information, see the talk titled "Measured in
milliseconds redux"
Did you notice that the memory leak occurred on just one browser or
across browsers?
On May 26, 8:40 am, Austen <awconsta...@gmail.com> wrote:
> To answer my own question, the following seems to be a far better way
> of doing things. Save creating all those new objects...
>
> public class Memoryleaktest implements EntryPoint {
>
> private FlexTable flexTable = new FlexTable();
> private HashMap<Integer, FlexTableRow> rows = new HashMap<Integer,
> FlexTableRow>();
>
> public void onModuleLoad() {
>
> RootPanel.get().add(flexTable);
>
> setupTable();
>
> Timer timer = new Timer() {
> public void run() {
> updateTable();
> }
> };
>
> timer.scheduleRepeating(10000); // 10 seconds
> }
>
> private void setupTable() {
> for (Integer i = 0; i < 50; i++) {
> FlexTableRow row = new FlexTableRow();
>
> flexTable.setWidget(i, 0, row.getTitle());
> flexTable.setWidget(i, 1, row.getHtml());
> flexTable.setWidget(i, 2, row.getLabel());
>
> rows.put(i, row);
> }
> }
>
> private void updateTable() {
> for (Integer i = 0; i < 50; i++) {
> FlexTableRow row = rows.get(i);
>
> row.getTitle().setText("ROW-" + i.toString());
> row.getHtml().setHTML("HTML Test " + i.toString());
> row.getLabel().setText("Label Test " + i.toString());
> }
> }
>
> Any comments/ideas about this approach?
>
> Thanks
>
> On May 26, 3:34 pm, Austen <awconsta...@gmail.com> wrote:
>
>
>
> > Hi All,
>
> > We have a problem with memory usage on all browsers when using a
> > flextable.
>
> > The table periodically updates over rpc and if left long enough will
> > consume all available ram.
>
> > The following example displays the issue.
>
> > public class Memoryleaktest implements EntryPoint {
>
> > private FlexTable flexTable = new FlexTable();
>
> > public void onModuleLoad() {
>
> > RootPanel.get().add(flexTable);
>
> > Timer timer = new Timer() {
> > public void run() {
> > updateTable();
> > }
> > };
> > timer.scheduleRepeating(10000); // 10 seconds
> > }
>
> > private void updateTable() {
> > flexTable.clear();
>
> > for (Integer i = 0; i < 50; i++) {
> > flexTable.setWidget(i, 0, new InlineLabel("ROW - " +
> > i.toString()));
> > flexTable.setWidget(i, 1, new HTML("Test HTML Widget 1-" +
> > i.toString()));
> > flexTable.setWidget(i, 2, new InlineLabel("Test InlineLabel Widget
> > 2-" + i.toString()));
> > }
> > }
>
> > }
>
> > Now I understand that we're probably going about this all wrong but
> > how should we do it?
>
> > Thanks in advance
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
No comments:
Post a Comment