Hmmm ... gee ... I really forgott about this :-(

And I have to admit that I have never really used the lastResult of a remote 
objects function. 
How about extending RemoteObject with Parameters to turn this Feature off?

Chris

________________________________________
Von: Maurice Amsellem [[email protected]]
Gesendet: Mittwoch, 6. November 2013 02:05
An: [email protected]
Betreff: 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

Reply via email to