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