Bojinx V4 beta
by admin on Oct.22, 2009, under Bojinx, Flex
Hey all,
It’s been some time hasn’t it! I’ve been busy as hell working on Bojinx and my daily duties but I’ve strung together a whole bunch of articles that I am tidying up and preparing to post on the new Bojinx blog, those of you using the old version can still access the old site through the URL located on the blog.
There is a new demo harness available, it doesn’t show everything Bojinx is capable of yet but I am adding more to it on a regular basis and I plan on placing some of the demos on TourDeFlex.
Click here to find out more about V4.
Click here to get V4.
Click here to download the demo harness.
Click here for the WIKI and setup instructions.
At the moment apart from the API documentation is limited while I clean it all up so I recommend you take a look at the demo harness to get an idea of how Bojinx works, the write ups will be up before you know it.
If you have any questions please use the message system on the Assembla site or post here.
Enjoy
Unloading modules completely, MXML.
by admin on May.19, 2009, under Flex
Hey all it’s been a while since I last posted anything that wasn’t to do with Bojinx, I’m just such a busy person with the family, Bojinx projects etc. But I hope to change that very soon.
I thought I’d start again with a topic that’s been plaguing me and many of my fellow flex developers and those who work with me. The topic being Modules wont unload fully when using MXML with Binding and in other circumstances they wont unload at all if you use certain components.
I’ve spent a lot of time reading through adobe code and found many issues that made me question why? The biggest issue I have encountered is that of some objects not unloading once the module unloads, even though I managed to get rid of the factory and the bind watcher for the module and restore almost all the memory back to the system the profiler reports several objects that never leave memory. One good thing though is that these are tiny and they don’t stack, once a module is loaded again they stay at their old values, one of the culprits being ButtonSkin.
The majority of of the issues related to components not fully releasing their sub components is event listeners not being released and many of them are strong, I did a test with ViewStack as it has many event listeners that dont get released, two of them are in the constructor and more memory was released when I made these all weak.
So I trawled through google and tried to find a way to get modules to fully unload, I have only been able to accomplish this in Actionscript by killing and nullifying absolutely everything I can find, this was time consuming but the Bojinx framework made it easy thanks to the dispose implementation. But I thought to myself I’d much rather use MXML to increase my productivity and only do complex logic and animation in my AS files while using MXML for all my general binding and layout requirements (remember up until now I have been unable to use MXML for anything but layout, any binding and my module refuses to unload even the simplest of modules.).
After reading through most of the module classes in the SDK I found some issues that would not allow a module to fully unload, one being several event listeners in the FlexModuleFactory that never get removed and the other issue being that if you use a component in your module that shares a style with the main application you are royally screwed! So I got underway trying to resolve these issues without touching adobe code but I couldn’t for the life of me, I had no choice but to implement a simple method in both ModuleManager and FlexModuleFactory that would allow me to release my modules.
The additions are few about 10 lines of code in total between both classes so it’s been easy to maintain and move with each upgrade of the SDK until adobe fix the outstanding bugs.
I placed the following in FlexModuleFactory:
/** * Destroys the active factory, getting rid of the cache. */ public function dispose():void { trace( "dispose factory" ); loaderInfo.removeEventListener(Event.COMPLETE, moduleCompleteHandler); timer.removeEventListener(TimerEvent.TIMER, timerHandler); if( nextFrameTimer ) { nextFrameTimer.stop(); nextFrameTimer.reset(); nextFrameTimer.removeEventListener(TimerEvent.TIMER, nextFrameTimerHandler); } stop(); }
I also implemented a class I created in the mx override folder called IFlexDisposable so that I could call dispose from the interface when the module manger tries to unload.
The next stage was to add the following code to the ModuleManager class:
/** * Placed this in ModuleManager * * @param url The url of the loaded module to unload */ public static function releaseModule( url:String ):void { getSingleton().releaseModule( url ); ModuleManagerGlobals.managerSingleton = null; } /** * @private * * Placed this in ModuleManagerImpl */ public function releaseModule(url:String):void { delete( moduleList[url] ); }
I also added the following to the unload method in ModuleManager to fire off the dispose method on the factory to remove the timer etc.
if( factoryInfo && factoryInfo.factory ) { factoryInfo.factory.dispose(); }
Now I could call ModuleManager.releaseModule( “TestModule.swf” ); whenever I was totally done with a module and wanted my memory back.
Now this brought up another issue, the modules would not unload if they were the first to register a class with the Singelton manager so I had to figure out a good way to give ownership of all component classes to a dependency module in order for all other modules to unload, this means my application and my module remain small in size and my dependency is’nt that bad either. Right so now I’ve created a dependency module that extends BaseModule and loaded it expecting it to add all my dependencies to the mix in list in the module factory instance for the dependency module and boom! nada mixins is null.
I spent hours trying to figure out why module base refused to supply a list of mixins and found that update does not get called on the AS version but only on MXML, doh! I then proceeded to place all my dependencies in an MXML module and woohoo I’ve got a dependency module I can load into my app and it can provide new modules their dependencies without ever having to release a new version of the application unless I changed core application functionality. SWEET.
Anyway I know this isn’t the most elegant solution but it’s quick to implement and if your like me and you are working on an application with over 120 modules that need to be created then being able to do most of the binding and layout in MXML is a god send and especially the memory recovery, a CMS can be open for days at a time and requires good resource management to stop it from crashing.
On to the goodies, I’ve included an application that you can download here, you will find several troublesome components being used in both module 1 and module 2 as well as a dependency module that gets loaded first, if you profile the app you will notice a great deal of memory is returned to the system, the minor leaks are to do with things like button skin but the leaks stop and amount to hardly much so can be ignored.
If anyone has better ideas or has discovered good ways to fully unload modules when using MXML please let me know! I’ve checked everywhere and I cant find anything that really works. ApplicationDomain didn’t help at all! It’s way too much work to reference the classes through application domain when you need them from so many other modules, they should just be included in the mixin list when they are compiled into a class to save the trouble of using getDefenition and with this method I can upgrade my dependencies without re-deploying the whole lot, just send over the dependency module and the new modules to the client through simple version checking and the Loader class to cache the Module locally.
Feel free to remove some dependencies from the Dependencies module and see how the application behaves. There is another import in the dependencies file called “deps” ignore this for now, I’m still experimenting with ways to try and recover 100% of memory. I’ll keep you up to date on my progress
Here is the source, feel free to provide input and suggestions
Update: I will release some nice ant scripts soon that combine the dependencies from both the dependencies module and the application module that will decrease the size of your modules a great deal, I currently use it for production but the code is messy so I’ll work on it and release it soon.
Some updates for Bojinx & Debugger
by admin on May.06, 2009, under Flex
It has been a while since I last posted, most of the action has been taking place on the Bojinx website and that’s not aggregated like my blog is. It’s been busy too so I haven’t had much time to post regular updates here.
A new version of the debugger has been released that fixes several bugs, improves performance and provides some new functionality some of which are listed below:
- See how long it takes your application to execute, each trace now carries a timestamp helping to improve performance.
- Filters have been improved and custom filters are no longer saved on exit, only the state of the default ones are.
- Total rework of the inspector.
- Larger objects are now supported, don’t go overboard though as it can get slow if you do, I hope to improve this in future releases.
- There are a few more updates listed on the Bojinx home page.
The core framework has also undergone a minor release since my last update and has much improved performance and 2 minor bug fixes.
All the plug-ins including the skeleton frameworks have been brought up to date to keep in sync with the core library.
You can read more at the Bojinx site.
Bojinx Core - V3.2 + Test harness (view source enabled)
by admin on Feb.20, 2009, under Flex
A new milestone has been reached with Bojinx, I think you will enjoy the new possibilities available and the flexibility now provided by the built in Command Sequencer.
You can read more about it here
You can download the test harness here (source enabled)
Update on PV3D Cleanup tools
by admin on Feb.17, 2009, under Bojinx, Flex
It’s been a while since my last update, as some of you already know my laptop was stolen about 2 weeks ago and along with it I lost 2 very cool libraries I was working on as part of the over all Bojinx package, one was the PV3D Utils which was more a utility library that wasn’t totally reliant on Bojinx and the other was the Extended navigation plugin that would allow you to have a more complex address layout as well as being able to use fluid layouts straight from within your address files.
I have been busy working on these from scratch
for the past week and hope to release the PV3D Utils again by the 22nd of February, this time with the source code if I manage to have it all cleaned up and understandable
If you are using the original library I uploaded previously you will just have to replace it but that should be about it.
In the mean time please feel free to sign up to the Bojinx newsletter so you can get updates when releases and new additions are made.
Registration bug fixed on Bojinx site
by admin on Feb.05, 2009, under Flex
Like the title says you can now register again on the Bojinx site, I put in the wrong URL on the registration link and just noticed
Well it finally happened
by admin on Feb.05, 2009, under General
So off I went to the London Pug yesterday only to end up taking a taxi back home thanks to someone stealing my Laptop bag with my car keys in there too
Unfortunately my latest set of libraries including the pv3d one were on there and not yet backed up so I have to start them from scratch too. Loosing a laptop these days is like loosing someone you care about
I haven’t felt this low in years.
Anyway if anyone was there and might have seen something please let me know, I was the guy with the white beanie and stripped brown hoodie the bag was at the back right of the bar where the meet was and is made by Incase. The police are looking into the CCTV footage but I am hoping someone picked it up by mistake.
PV3D Destruction Utils - V0.6B and Other updates
by admin on Feb.04, 2009, under Bojinx, Flex, General
It’s here the first release although beta I could use everyone’s help to test it and make it better as well as adding more features to it. You can submit requests or bugs through the ticket system on the Bojinx site please make sure you specify what library the plugin is for in the subject.
You can find the new Utility class under the Downloads/Utilities section at the Bojinx site as well as links to examples, usage etc.
On another note I have also been working on two new plugins that wont be available for a short while yet but I thought you might be interested in knowing about them. One is an MDI plugin that interfaces with the Navigation plugin and does many cool things such as (window shake to minimize - I had to do it sorry) and an informative docked icon system that lets you know when a docked item has been unloaded from memory as well as other status colors etc.
The other plugin is another addon to the Navigation plugin that allows you to have much more flexible address files by letting you specify the positions and sizes (inc %) for all your modules letting you change the entire look and feel of your application on the fly through address files, pretty usefull for branding. It does some other cool stuff but I will leave that for later.
Bojinx getting started guide - first of many
by admin on Feb.03, 2009, under Bojinx, Flex
Well the first one is here
I know it took some time and I’m sorry for that been very busy as usual.
This first article I thought would be useful because it deals with some core aspects of the Bojinx frame work and incorporates the Navigation and Services plugins so it’s a good starting point for most projects.
New guides and articles are constantly being worked on so if you have any requests let us know. Keep checking the Tutorials section as well as the home page for new articles and release updates.
You can find a link to the new guide on the Bojinx home page.
Oops forgot demo link - PV3D memory management
by admin on Jan.29, 2009, under Flex, General
Sorry to all those that ended up reading the articles I posted yesterday only to reach the end and find there was no link to any demo!
The original article was here and the article with the demo is located here. I have added two links to the demo, one mid way and the other at the bottom.









