flex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sugan Naicker" <Su...@Dev-X.co.za>
Subject RE: RemoteOperation last result not garbage collected
Date Wed, 06 Nov 2013 03:49:30 GMT
Hi Maurice,

Thanks for sharing!

Regards,

Sugan Naicker
South Africa



-----Original Message-----
From: Maurice Amsellem [mailto:maurice.amsellem@systar.com] 
Sent: 06 November 2013 03:05 AM
To: users@flex.apache.org
Subject: RemoteOperation last result not garbage collected

Hi,

I discovered a not-so-known behavior of RemoteObject that could be useful to
the community:

RemoteObject RemoteOperations are keeping a reference to the last call
result, that can be retrieved through lastResult property.
Most of the time, you don't need that reference, as you will be processing
the result in the result handlers.

For operations that are called often, and return small result, it's not an
issue.
The problem raises if you have a RemoteObject with an operation that is
called once (or only a few times) and returns a large result.  
This could be the case for operations that are called at initialization
only, and that loads large results from the server.
In this case, the result of the last (and only) call, will not be garbage
collected.

To avoid this, you must clear the result manually in the result handler:.

For example:

protected function handleGenericVOResult(resultEvent:ResultEvent,
token:AsyncToken = null):void {
    var op: AbstractOperation =
_remoteObject.getOperation(RemotingMessage(token.message).operation);
    op.clearResult(false);}
}

Hope this helps...

Maurice 



Mime
View raw message