views:

901

answers:

1

Hello out there,

these days I read a lot with regards to RSLs. One disadvantage is that RSLs must be loaded into memory but can save significant loading time.

Now what happens in the following scenario:

I have a superFramework.swf and a subapp.swf. subapp.swf is displayed and loaded on demand within superframework.swf using the SWFLoader. However both SWFs have dependencies to the common.swc, which will be compiled as RSL.

So the dependcies look like this:

superframework.swf           ---RSL---> common.swc
   ---SWFLoader-->subapp.swf ---RSL---> common.swc

Now my questions:

  • Is the subapp.swf loaded in a separate memory space?
  • If yes: Does this mean that the common.swc RSL is loaded twice into memory?
  • If no: What about singletons like a ModelLocator in the common.swc. Is the same instance available to subapp.swf and superframework.swf at the same time?
+2  A: 

RSLs are not true dynamic libraries. They are more like static linking the entire library at runtime.

  • Is the subapp.swf loaded in a separate memory space?

Yes, sort of. All SWFs run in the Flash Player. They have their own little sandboxes for security reasons.

  • If yes: Does this mean that the common.swc RSL is loaded twice into memory?

Yes, each calling application loads one copy of a given RSL.

  • If no: What about singletons like a ModelLocator in the common.swc. Is the same instance available to subapp.swf and superframework.swf at the same time?

No, they will have different instances.

RSLs help reduce the distributable's size. But this is not necessarily an advantage always. I suggest you go through this page before taking a leap.

dirkgently
Thank you for your answer... well... after some more reading I guess that I do not want to use the SWFLoader, but to use the ModuleLoader with Modules instead. My assumption is that in this case, RSLs are shared.
Yaba
Are you trying to load RSLs via ModuleLoader? I hope I misunderstood. Anyway, feel free to play around.
dirkgently
Indirectly... I want to use Module Loader instead of the SWF Loader to load components on demand from a bigger framework. As these components may have dependencies to RSLs that are also required and already loaded by the framework, my assumption is that using the Module Loader the already loaded...
Yaba
...RSLs are reused.
Yaba