Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » memory leaks
memory leaks [message #873421] Fri, 18 May 2012 07:52 Go to next message
bogdan toma is currently offline bogdan tomaFriend
Messages: 39
Registered: February 2010
Member
Hello all,

I have done some tests and i discovered a possible memory leak.
I am using RAP1.4 1.4.0.20110614-2335.
class org.eclipse.swt.widgets.TableItem in TableItem.js
This is the code for dispose function:
 /* Need to override dispose() here because the call to parent._removeitem()
     * has to happen immediately. The usual way (putting the code in destruct) 
     * would be executed in the socalled "dispose-queue" somewhen later. */
    dispose : function() {
      this.base( arguments );
      //removed comments as it contains links
      if( !this._parent.getDisposed() && !qx.core.Object.inGlobalDispose() ) {
        this._parent._removeItem( this );
      }
      org.eclipse.swt.WidgetManager.getInstance().remove( this );      
    },


This function makes a call to this.base( arguments ); which i think calls something like super.dispose, in this case dispose of qx.core.Object. Seems that qx.core.Object.dispose calls destruct on all Mixins, in our case qx.core.MUserData:
destruct : function() {
    this._disposeFields("__userData");
  }


By the time this.base( arguments ); returns the userdata "id" of the TableItem is diposed. So this call org.eclipse.swt.WidgetManager.getInstance().remove( this ); will not remove the widget, since the id has disappeared. So WidgetManager will keep the reference to the TableItem.

If I move this call this.base( arguments ); to the end of dispose function seems everything will be disposed.

As for some some figures:
I have done the following test:
Step 1.
construct 10 tableviewers with 8 rows; wait 1s; dispose the 10 tableviewers; wait a 1s; I run this 300 times.
Step2. I run Step1. 10 times and after each Step1. I measure the firefox memory size (private bytes in K - i using pslist utility program):

With original version of TableItem.js:

"before table viewer";132036;
"after table viewer";184748;
"before table viewer";189684;
"after table viewer";233576;
"before table viewer";238524;
"after table viewer";270740;
"before table viewer";275548;
"after table viewer";307172;
"before table viewer";311420;
"after table viewer";347840;
"before table viewer";352852;
"after table viewer";386192;
"before table viewer";390804;
"after table viewer";421664;
"before table viewer";426132;
"after table viewer";448460;
"before table viewer";452752;
"after table viewer";;481260;
"before table viewer";486164;
"after table viewer";524228;

With the call to this.base( arguments ); to the end of TableItem.dispose function:

"before table viewer";65324;
"after table viewer";76688;
"before table viewer";80812;
"after table viewer";80476;
"before table viewer";85324;
"after table viewer";;80404;
"before table viewer";85308;
"after table viewer";81148;
"before table viewer";85740;
"after table viewer";80120;
"before table viewer";85016;
"after table viewer";80588;
"before table viewer";85544;
"after table viewer";80516;
"before table viewer";85268;
"after table viewer";80652;
"before table viewer";85380;
"after table viewer";80272;
"before table viewer";85152;
"after table viewer";80988;



Please tell me if it is correct regarding the memory leak of TableItem.
Or maybe how do you tests the client side for memory leaks.
Thank you.
Re: memory leaks [message #873451 is a reply to message #873421] Fri, 18 May 2012 09:05 Go to previous messageGo to next message
Tim Buschtoens is currently offline Tim BuschtoensFriend
Messages: 396
Registered: July 2009
Senior Member
Hi.

I just checked against 1.5, there it seems fine. However, the Table has
been rewritten for 1.5 - so there still might be something to your
theory. 1.4 already got its final service release, therefore this will
probably not updated in the repository. But your fix looks valid, so i
guess its working for you?

Greetings,
Tim


Am 18.05.2012 09:52, schrieb bogdan toma:
> Hello all,
>
> I have done some tests and i discovered a possible memory leak.
> I am using RAP1.4 1.4.0.20110614-2335.
> class org.eclipse.swt.widgets.TableItem in TableItem.js
> This is the code for dispose function:
>
> /* Need to override dispose() here because the call to parent._removeitem()
> * has to happen immediately. The usual way (putting the code in
> destruct) * would be executed in the socalled "dispose-queue" somewhen
> later. */
> dispose : function() {
> this.base( arguments );
> //removed comments as it contains links
> if( !this._parent.getDisposed() && !qx.core.Object.inGlobalDispose() ) {
> this._parent._removeItem( this );
> }
> org.eclipse.swt.WidgetManager.getInstance().remove( this ); },
>
>
> This function makes a call to this.base( arguments ); which i think
> calls something like super.dispose, in this case dispose of
> qx.core.Object. Seems that qx.core.Object.dispose calls destruct on all
> Mixins, in our case qx.core.MUserData:
> destruct : function() {
> this._disposeFields("__userData");
> }
>
> By the time this.base( arguments ); returns the userdata "id" of the
> TableItem is diposed. So this call
> org.eclipse.swt.WidgetManager.getInstance().remove( this ); will not
> remove the widget, since the id has disappeared. So WidgetManager will
> keep the reference to the TableItem.
>
> If I move this call this.base( arguments ); to the end of dispose
> function seems everything will be disposed.
>
> As for some some figures:
> I have done the following test: Step 1.
> construct 10 tableviewers with 8 rows; wait 1s; dispose the 10
> tableviewers; wait a 1s; I run this 300 times.
> Step2. I run Step1. 10 times and after each Step1. I measure the firefox
> memory size (private bytes in K - i using pslist utility program):
>
> With original version of TableItem.js:
>
> "before table viewer";132036;
> "after table viewer";184748;
> "before table viewer";189684;
> "after table viewer";233576;
> "before table viewer";238524;
> "after table viewer";270740;
> "before table viewer";275548;
> "after table viewer";307172;
> "before table viewer";311420;
> "after table viewer";347840;
> "before table viewer";352852;
> "after table viewer";386192;
> "before table viewer";390804;
> "after table viewer";421664;
> "before table viewer";426132;
> "after table viewer";448460;
> "before table viewer";452752;
> "after table viewer";;481260;
> "before table viewer";486164;
> "after table viewer";524228;
>
> With the call to this.base( arguments ); to the end of TableItem.dispose
> function:
>
> "before table viewer";65324;
> "after table viewer";76688;
> "before table viewer";80812;
> "after table viewer";80476;
> "before table viewer";85324;
> "after table viewer";;80404;
> "before table viewer";85308;
> "after table viewer";81148;
> "before table viewer";85740;
> "after table viewer";80120;
> "before table viewer";85016;
> "after table viewer";80588;
> "before table viewer";85544;
> "after table viewer";80516;
> "before table viewer";85268;
> "after table viewer";80652;
> "before table viewer";85380;
> "after table viewer";80272;
> "before table viewer";85152;
> "after table viewer";80988;
>
>
>
> Please tell me if it is correct regarding the memory leak of TableItem.
> Or maybe how do you tests the client side for memory leaks.
> Thank you.

--
Tim Buschtöns

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: memory leaks [message #873470 is a reply to message #873451] Fri, 18 May 2012 10:01 Go to previous message
bogdan toma is currently offline bogdan tomaFriend
Messages: 39
Registered: February 2010
Member
Hello,

thank you for reply.
it works, but i am using "Debug" version of the qooxdoo, so i guess i have to build it by myself into client.js.
Also i have some similar problem when opening and closing editors in RAP. Seems that in Shell.js a composite widget gets in there , but it is never removed.

addActivateListenerWidget : function( widget ) {
      this._activateListenerWidgets.push( widget );
   }


Code for opening/and closing editors:
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(new NullEditorInput(), "de.softcon.testrap.DummyTestEditor");

PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().closeAllEditors(false);


Thank you.
Previous Topic:DefaultClassLoader error in RAP application when run in Eclipse
Next Topic:Multi User Application - Guidelines?
Goto Forum:
  


Current Time: Sun Oct 24 23:14:00 GMT 2021

Powered by FUDForum. Page generated in 0.01985 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top