/[Apache-SVN]
ViewVC logotype

Revision 1262243


Jump to revision: Previous Next
Author: (unknown author)
Date: Mon Jan 30 17:35:43 2012 UTC (12 years, 3 months ago)
Changed paths: 1
Log Message:
Transferred from the Adobe Open Source Subversion Repository

Revision: 17116
Author:   dloverin@adobe.com
Date:     2010-07-29T13:27:01.624740Z

Log Message: 
-----------
Prevent sub-applications and modules from being pinned in memory by ResourceManager.

This set of changes fixes a module leak that is cause by resource bundles. The ResourceManager is a singleton the holds a reference to all resource bundles in the system. This includes sub-applications and modules. The leaks occurs when a sub-application or module defines a new resource bundle that is not in the application domain of the main application. Creating a new instance of this resource bundle creates a reference from the main application to the application domain of the sub-application or module, pinning it in memory. 

The solution to the module leak problem is to modify the ResourceManager API to allow an application to opt-in to maintaining references to their own resource bundles instead of allowing ResourceManager to do it. Since the resource bundles are referenced by the applications or modules, the ResourceManager can keep a weak reference to the resource bundles which will allow the references to be garbage collected when the sub-applications or modules are garbage collected.

So how are does the ResourceManager allow you to opt-in? A useWeakReference parameter was added to both the addResourceBundle and installCompiledResourceBundles functions. The new parameter has a default value of "false" if no value is supplied. A value of "false" provides the old behavior so older applications compiling with the new API will see no change in behavior. A value of "true" for useWeakReference tells the ResourceManager to provide a weak reference with the agreement that the caller will provide a hard reference. Flex sub-applications and modules automatically opt-in to use the new weak reference capability.

The addResourceBundle function adds just the new useWeakReference. A value of true means the caller should store the passed resourceBundle in an application instance variable.

The installCompiledResourceBundles function also has a new parameter useWeakReference and now returns an Array (used to return void). The useWeakReference parameter has the same meaning as in addResourceBundle. The installCompiledResourceBundles function returns and array of resource bundles to give the caller and opportunity to had a hard reference to them.

QE notes: None.
Doc notes: None.
Bugs: SDK-24306
Reviewer: Alex (code), Gordon (API)
Tests run: checkintests, cyclone server
Is noteworthy for integration: No.

Modified Paths:
--------------
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/framework/src/mx/managers/SystemManager.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/framework/src/mx/resources/ResourceManagerImpl.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/framework/src/mx/core/FlexModuleFactory.as</path>
<path kind="file" action="M">/private/flex/sdk/branches/hero_private/frameworks/projects/framework/src/mx/resources/IResourceManager.as</path>

Changed paths

Path Details
Directoryincubator/flex/trunk/frameworks/projects/framework/src/mx/resources/ResourceManagerImpl.as modified , text changed

infrastructure at apache.org
ViewVC Help
Powered by ViewVC 1.1.26