[flexcoders] Module GC question
So here is the situation. I have an app that loads up a module, passes the module a reference to a VBox residing in the app. The module then tosses in a couple UI components into the VBox that are attached to some processing going on in the module. Within the module there is a timer firing off events every few seconds and I can see this with some trace output. When I unload the module, or unload the module and clear the Vbox children wise I still see the timer event firing my trace. My question is this shouldn't unloading the module wipe out that timer? If it doesn't as it would seem it is not, it would stand to reason that GC is never going to pick it up leading to a wonderful memory leak if load up any more of that module. If thats the case what is the best way to free up that memory? Thanks in Advance, Kyle
[flexcoders] Re: Module GC question
I found a really good series of articles further explaining my issue. On the off chance anyone has a similar issue here they are. http://www.gskinner.com/blog/archives/2006/06/as3_resource_ma.html http://www.gskinner.com/blog/archives/2006/07/as3_resource_ma_1.html http://www.gskinner.com/blog/archives/2006/08/as3_resource_ma_2.html Specifically the one pertaining to my issue is: http://www.gskinner.com/blog/archives/2006/07/as3_resource_ma_1.html
[flexcoders] Re: Module GC question
So it would be best to remove all listeners that you can and set every var the module is using to null before unloading it to get that memory back. That's definitely doable I'm just surprised that unloading the module doesn't wipe out all those references. Thanks for the quick reply Alex!
[flexcoders] Multiple Modules Best Practices
So after struggling with a memory leak pertaining to the loading of multiple modules and references hanging about after unloading said modules I am curious how others are dealing with the situation. I know there must be others out there loading up multiple modules in widget-like fashion. The example that comes to mind was a Portal app that loaded various widgets into it. Unfortunately the only examples I've found online use very simple UI based modules. I understand that weak references are the key I just seem to be unable to come up with a good solution. To those of you out there using modules that a do more than display a UI component how are you managing the loading/unloading and destruction of the modules loaded?
[flexcoders] Re: Module GC question
So I've been playing with ways trying to get the many module memory issue cleared up and seem to be unable to get it to work in even a very simple test case. Any chance you can tell me what I am doing wrong here? When I force GC I can see the swf getting unloaded etc but the memory use just keeps going up. APP: http://www.adobe.com/2006/mxml"; layout="vertical" creationComplete="init()"> CUSTOMLOADER: package com.widget { import flash.events.EventDispatcher; import flash.events.IEventDispatcher; import mx.modules.IModuleInfo; import mx.modules.ModuleManager; import flash.utils.Dictionary; import mx.events.ModuleEvent; import flash.display.DisplayObjectContainer; import mx.utils.NameUtil; public class CustomModLoader extends EventDispatcher { //REF TO ALL MODS private var allMods : Dictionary; public function CustomModLoader() { super(); allMods = new Dictionary(true); } public function loadMod(url : String, display : DisplayObjectContainer, args : Array) : Object { //var module : IModuleInfo = ModuleManager.getModule(url); var uniName : Object = NameUtil.createUniqueName('Widget'); allMods[uniName] = new Array(); (allMods[uniName] as Array)['info'] = ModuleManager.getModule(url) as IModuleInfo; //module.addEventListener(ModuleEvent.READY, modReady); // module.addEventListener(ModuleEvent.ERROR, modError); (allMods[uniName] as Array)['info'].addEventListener(ModuleEvent.READY, modReady); (allMods[uniName] as Array)['info'].addEventListener(ModuleEvent.ERROR, modError); function modReady(e : ModuleEvent) : void { (allMods[uniName] as Array)['info'].removeEventListener(ModuleEvent.READY, modReady); (allMods[uniName] as Array)['info'].removeEventListener(ModuleEvent.ERROR, modError); //module.removeEventListener(ModuleEvent.READY, modReady); //module.removeEventListener(ModuleEvent.ERROR, modError); trace(uniName + " - READY"); (allMods[uniName] as Array)['mod'] = ( (allMods[uniName] as Array)['info'] as IModuleInfo ).factory.create() as IWidgetMod; //var widget : IWidgetMod = module.factory.create() as IWidgetMod; ( (allMods[uniName] as Array)['mod'] as IWidgetMod ).init(display, args); uniName = null; //widget.init(display, args); //allMods[uniName] = {mod: widget, info: module}; /* widget = null; module = null; uniName = null; */ } function modError(e : ModuleEvent) : void { trace("error loading module " + e.module.url); (allMods[uniName] as Array)['info'].removeEventListener(ModuleEvent.READY, modReady); (allMods[uniName] as Array)['info'].removeEventListener(ModuleEvent.ERROR, modError); uniName = null; } ( (allMods[uniName] as Array)['info'] as IModuleInfo ).load(); //module.load(); return uniName; } public function killMod(name : Object) : void { if(allMods[name] != null) { ( (allMods[name] as Array)['mod'] as IWidgetMod ).destroy(); ( (allMods[name] as Array)['info'] as IModuleInfo ).release(); ( (allMods[name] as Array)['info'] as IModuleInfo ).unload(); (allMods[name] as Array)['mod'] = null; (allMods[name] as Array)['info'] = null; allMods[name] =null; delete allMods[name]; } else { trace("NO MOD!"); } /* if(allMods[na
[flexcoders] Re: Module GC question
UPDATE: It would seem I have the same memory problem even when using the higher level ModuleLoader. I get the same results memory wise with my system or the module loader. It still unloads the swf etc, but continues to eat more and more memory. http://www.adobe.com/2006/mxml"; layout="vertical" creationComplete="init()">
[flexcoders] Re: Open source Flex (incl. compiler)
To be honest I am not surprised that flex is going open source and was just talking about this with a friend of mine a day or so ago. I figured it was only a matter of time. Logically it makes sense and I think it's a smart move on Adobe's part. In doing so they open up the doors to developers from all walks to jump in and get their hands dirty with flex and effectively ramp up development on Flex. This in turn leads to better adoption of the platform, better components, integration etc etc. Plus from a business standpoint they're still making money with FDS and going to increase the demand for said product with greater adoption of Flex. All the same kudos and thank you to Adobe! - Kyle VanVranken
[flexcoders] Re: Module GC question
UPDATE: So it would seem the hack method of forcing garbage collection for my test was actually causing the trouble. - try { new LocalConnection().connect('foo'); new LocalConnection().connect('foo'); } catch (e:*) {} - Without that code it seems to be working nicely now. I've had a test app running on my machine now for a bit with a timer every couple seconds reloading the simple module and it appears to be working as intended now. I don't really understand why forcing GC was causing it to eat up more memory then not forcing, but I am sufficiently satisfied that it seems to be working.
[flexcoders] Re: Module GC question
Think I misread your post the first time. As for being sure you can see it unload the swf in console. Documentation wise I've seen it a couple places. One of them being here: http://www.gskinner.com/blog/archives/2006/08/as3_resource_ma_2.html It's said that you should only use it in testing. - Kyle
[flexcoders] Re: Module GC question
Well as soon as I removed the call to force GC it started working. I cant be sure, but logically it would make sense.
[flexcoders] Re: Module GC question
To be honest I couldn't tell you why it was causing the issue. As for your problem, all the documentation I have seen on using the GC "hack" says that it is just that a hack. You're not supposed to be able to trigger GC and as such that it should only be used as a tool in testing. My advice would be to step back for a min and find out what is actually causing the memory leak you're having. At best the GC hack would be a bandaid for the real issue at hand. I realize we all have deadlines to make, but if your memory leak is that bad it would seem to make sense that the greater good would be served by fixing what is causing the leak.
[flexcoders] Viewstack in a Popup
In my wandering I have seen conflicting reports on if you can use a ViewStack/TabNav/Accordian component within a popup. The following link's author appeared to be having an issue memory wise when they used one of these components in a popup. http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=60&catid=585&threadid=1180780&enterthread=y So can you use a ViewStack in a popup without memory problems? Thanks, - Kyle
[flexcoders] Re: Viewstack in a Popup
Thank you again Alex! You are always the first guy to answer. - Kyle
[flexcoders] Re: RIA: record insert best practices
+1 for the back end. If nothing else to further abstract your underlying data layer. It might help to think of flex as your medium for displaying/interacting with all that data in a useful/meaningful way. Leave things like UID generation serverside.
[flexcoders] Re: Data Push with Remote Objects
First off let me preface this in saying I'm not a Java guy, least not just yet. To my understanding there are a couple options you have that may or may not work for your given situation. 1. Polling - not really much fun and pretty inefficient. 2. Setting up a version system for the data that needs to be updated. For instance a contact list that every time it is updated increments the last version. You send you updated contact to GDS it see's the version you're updating isn't the current version and alerts you etc. 3. Setup your own Java messaging via whatever app server you're using. So you update X contact it alerts the message service that anyone with X contact should update to the new one you updated. More or less I believe thats all FDS does. Mind you they have it all setup nice and clean for you already. I know Red5 has a JMS system built into it that Flex can consume, so assuming Flex can connect to any JMS it would just be a matter of setting it up and making the appropriate announcements across the JMS within your update service etc. It really comes down to how "real time" you need your data to be. The first to options would be pretty easy to implement. The 3rd, as I'm not a Java guy once again, I'm not 100% sure about. You might try contacting someone over at GDS as I'm sure if nothing else it would make for an awesome feature request if they're not already working on something like that. Out of curiosity how are you liking GDS? Currently the project I am working on uses AMFPHP and I was thinking of moving to FDS(big $ maybe there) or something open source like GDS for the next version of the project. I haven't seen too many people using GDS yet so any info on your experiences thus far would be greatly appreciated. - Kyle
[flexcoders] Re: Flex: Modular Applications
This might help with you're listeners. http://www.gskinner.com/blog/archives/2006/07/as3_weakly_refe.html - Kyle
[flexcoders] Re: Flex: Modular Applications
I have been having the same issue more or less. See here: http://tech.groups.yahoo.com/group/flexcoders/message/71791 >From what it looks the only way to get most of it cleaned up is to implement some sort of cleanup method on all your modules. Making things like listeners weak should make this a little easier. I really wish there was more documentation wise about "Best Practices" in dealing with modules short of the simple examples loading a UI component as a module. If that's all they're meant to do why bother. A REAL example with a module that has things like a Remote Object in it. Examples of how best to load it up AND properly unload/dispose of it all. - Kyle --- In flexcoders@yahoogroups.com, Christopher Olsen <[EMAIL PROTECTED]> wrote: > > Kyle, > > Thanks a bunch this should help... > > I'm guess things like producers/responders would also need to be > disconnected first before garbage collection happens? > Because when i unload a module all these things appear to continue to > hang around. > > -Christopher > > kyle.vanvranken wrote: > > > > This might help with you're listeners. > > > > http://www.gskinner.com/blog/archives/2006/07/as3_weakly_refe.html > > <http://www.gskinner.com/blog/archives/2006/07/as3_weakly_refe.html> > > > > - Kyle > > > > >
[flexcoders] Re: [cairngorm-devel] Flex HotFix 2 and Cairngorm 2.2
I feel you on the hotfix installation. It would be nice if you could just run the update from within eclipse/fb. On a more positive note whoohoo for fixing some GC issues! - Kyle
[flexcoders] Re: [cairngorm-devel] Flex HotFix 2 and Cairngorm 2.2
It's really not that big of a deal. I mean extracting a zip is not that hard I was just saying in an "ideal" situation using the updater would be nice. I suppose that if I had to choose between waiting longer for hotfixes or having to manual patch I most defiantly choose manual patching! :) Also any ETA on the hotfix friendly Cairngorm?
[flexcoders] Re: [cairngorm-devel] Flex HotFix 2 and Cairngorm 2.2
Thank you very much! That was quick too! - Kyle
[flexcoders] Hotfix 2 and Modules
So after installing the most recent hotfix I am getting a new error when trying to load a module. Maybe its me, but it was working before the hotfix. VerifyError: Error #1053: Illegal override of subtopic in mx.messaging.Consumer. at flash.display::MovieClip/nextFrame() at mx.core::FlexModuleFactory/mx.core:FlexModuleFactory::deferredNextFrame()[C:\dev\flex_201_gmc\sdk\frameworks\mx\core\FlexModuleFactory.as:365] at mx.core::FlexModuleFactory/mx.core:FlexModuleFactory::update()[C:\dev\flex_201_gmc\sdk\frameworks\mx\core\FlexModuleFactory.as:262] at mx.core::FlexModuleFactory/mx.core:FlexModuleFactory::moduleCompleteHandler()[C:\dev\flex_201_gmc\sdk\frameworks\mx\core\FlexModuleFactory.as:454] Here is the code that is throwing the error: private function makeLivePreview() : void { var module : IModuleInfo = ModuleManager.getModule('ImageWidget_2_3-debug.swf'); module.addEventListener(ModuleEvent.READY,modError); module.addEventListener(ModuleEvent.ERROR,modReady); module.addEventListener('ReallyReady',modReallyReady); module.load(); function modError(e : ModuleEvent) : void { trace('MOD ERROR'); } function modReady(e : ModuleEvent) : void { trace('MOD READY'); } function modReallyReady(e : Event) : void { trace('MOD REALLY READY'); } } - Kyle
[flexcoders] Re: Hotfix 2 and Modules
So oddly enough... var module : IModuleInfo = ModuleManager.getModule('ImageWidget_2_3-debugswf'); that works..found out when I fat fingered it in doing some testing. Yeah no idea here. - Kyle
[flexcoders] Re: Hotfix 2 and Modules
Suppose I should clarify, by works I mean it will at least hit my modError func, as it should. And yes in the 1st post I realized I had the funcs for ready/error swapped. Not enough coffee yet.
[flexcoders] Re: Is anyone using WebORB with a Java back end?
I haven't had much experience with WebORB, but I believe it was meant to be used with langs other then Java. I remember reading something about not planing to have a Java version as FDS already does that well. One product you might want to check out as a Java alternative: http://www.graniteds.org/confluence/display/INTRO/Granite+Data+Services+Overview Not tons of info on it on this board, but I believe some people are using it pretty successfully.
[flexcoders] F10 in AIR problem
Anyone here have any experience using function keys in AIR? I am having a problem most specifically with the F10 key under windows. The default behavior of said key being to open the current window's context window. Any help would be greatly appreciated. Thanks, Kyle
[flexcoders] Re: F10 in AIR problem
They key handler for the F10 key is working. The problem is that immediately there after the focus is pulled to the windows context menu. For example you hit F10 which triggers some alert prompt. You try and hit enter to dismiss the alert but when you do so the windows context menu pops up.Hit enter again and focus is returned and the alert is dismissed. Basically I want to disable this context menu functionality. -Kyle --- In flexcoders@yahoogroups.com, Tom Chiverton wrote: > > On Tuesday 03 Mar 2009, kyle.vanvranken wrote: > > behavior of said key being to open the current window's context window. Any > > help would be greatly appreciated. > > You mean, it should but doesn't, or you've tried writing a key press event > handler and it isn't getting through ? > > -- > Tom Chiverton > Helping to apprehensively transform eyeballs > as part of the IT team of the year, '09 and '08 > > > > This email is sent for and on behalf of Halliwells LLP. > > Halliwells LLP is a limited liability partnership registered in England and > Wales under registered number OC307980 whose registered office address is at > Halliwells LLP, 3 Hardman Square, Spinningfields, Manchester, M3 3EB. A list > of members is available for inspection at the registered office together with > a list of those non members who are referred to as partners. We use the word > ?partner? to refer to a member of the LLP, or an employee or consultant with > equivalent standing and qualifications. Regulated by the Solicitors > Regulation Authority. > > CONFIDENTIALITY > > This email is intended only for the use of the addressee named above and may > be confidential or legally privileged. If you are not the addressee you must > not read it and must not use any information contained in nor copy it nor > inform any person other than Halliwells LLP or the addressee of its existence > or contents. If you have received this email in error please delete it and > notify Halliwells LLP IT Department on 0870 365 2500. > > For more information about Halliwells LLP visit www.halliwells.com. >