Hello list,
I'm working on a modular application where all services and value objects
are stored in a RSL. The inconvenient with this organization is that when a
value object alias is registered by a module during an AMF call it cause a
memory leak revealed by a console warning :
warning: The class myValueObject has been used in a call to
net.registerClassAlias() in _myModule_FlexInit. This will cause myModule to
be leaked. To resolve the leak, define myValueObject in the top-level
application.
I want my value objects to be in a RSL so my workaround is to force the main
application to register the alias of all VO's at startup in a loop :
public function RegisterClasses()
{
var classDefinitions:Vector.<String> =
ApplicationDomain.currentDomain.getQualifiedDefinitionNames();
for (var i:int = 0; i < classDefinitions.length; i++)
{
if
(classDefinitions[i].indexOf("fr.mydomain.core.vo") >= 0)
{
var aliasName:String =
String(classDefinitions[i].split(".").pop()).replace("::", ".");
registerClassAlias(aliasName,
getDefinitionByName(classDefinitions[i])
as Class);
}
}
}
It works but if anyone found a better way to handle this issue I would be
glad to hear how.
Thanks.
--
View this message in context:
http://apache-flex-users.2333346.n4.nabble.com/Memory-leaks-management-in-modules-tp3422.html
Sent from the Apache Flex Users mailing list archive at Nabble.com.