You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@flex.apache.org by Jaabax <ja...@gmail.com> on 2017/10/17 22:01:25 UTC

How many instances of RemoteObject should I create?

Hello!

I would like to know if I need to create an instance of RemoteObject for
each request of if I can create just one and reuse it.

I am currently creating a new instance of each and every request my
application does.

can I reuse RemoteObjects that target the same channel/destination?

and what about multiple requests from different screens to the same
destination? how to handle it?

thank you in advance




--
Sent from: http://apache-flex-development.2333347.n4.nabble.com/




--
Sent from: http://apache-flex-users.2333346.n4.nabble.com/

Re: How many instances of RemoteObject should I create?

Posted by Javier Guerrero García <ja...@gmail.com>.
Agree with Jeffry "by the book", but since Flex GC is reaaaaally picky when
choosing which things it considers garbage (don't forget not even one event
listener, or bind, or....), your current option is at least "safest".

-> Your option: you are really really really sure there is just one
instance in memory, maybe unuseful, but just one

-> Jeffry's: it MIGHT get you down to even 0 instances when not useful
(perfect!), but you can easily get to two million unuseful ones if you are
not really careful when coding (or 3-4 other factor, such as the GC not
having enough time to do it's job) and get yourself a pretty memory leak in
the app

As Jeffry said, you'll have to take your own decision evaluating all other
unspoken factors :) Is having just one "extra" remote object consuming
memory worth the risk?



On Wed, Oct 18, 2017 at 1:19 AM, Jeffry Houser <je...@dot-com-it.com>
wrote:

>
>  I'd probably create one for each request, so that the instance can be
> garbage collected after the transaction and not be kept around in memory.
>
>  However, there are so many factors involved here, it is tough to give
> specific direction.  There is no reason you can't reuse them.
>
>
>
> On 10/17/2017 6:01 PM, Jaabax wrote:
>
>> Hello!
>>
>> I would like to know if I need to create an instance of RemoteObject for
>> each request of if I can create just one and reuse it.
>>
>> I am currently creating a new instance of each and every request my
>> application does.
>>
>> can I reuse RemoteObjects that target the same channel/destination?
>>
>> and what about multiple requests from different screens to the same
>> destination? how to handle it?
>>
>> thank you in advance
>>
>>
>>
>>
>> --
>> Sent from: http://apache-flex-development.2333347.n4.nabble.com/
>>
>>
>>
>>
>> --
>> Sent from: http://apache-flex-users.2333346.n4.nabble.com/
>>
>
> --
> Jeffry Houser
> Technical Entrepreneur
> http://www.jeffryhouser.com
> 203-379-0773
>
>

Re: How many instances of RemoteObject should I create?

Posted by Jeffry Houser <je...@dot-com-it.com>.
  I'd probably create one for each request, so that the instance can be 
garbage collected after the transaction and not be kept around in memory.

  However, there are so many factors involved here, it is tough to give 
specific direction.  There is no reason you can't reuse them.


On 10/17/2017 6:01 PM, Jaabax wrote:
> Hello!
>
> I would like to know if I need to create an instance of RemoteObject for
> each request of if I can create just one and reuse it.
>
> I am currently creating a new instance of each and every request my
> application does.
>
> can I reuse RemoteObjects that target the same channel/destination?
>
> and what about multiple requests from different screens to the same
> destination? how to handle it?
>
> thank you in advance
>
>
>
>
> --
> Sent from: http://apache-flex-development.2333347.n4.nabble.com/
>
>
>
>
> --
> Sent from: http://apache-flex-users.2333346.n4.nabble.com/

-- 
Jeffry Houser
Technical Entrepreneur
http://www.jeffryhouser.com
203-379-0773