Archive for November, 2007

AS3.0 Memory monitoring


I just came across the property System.totalMemory. It’s very useful, especially for the engine I am currently working on, and dealing with AS3 garbage collection.

It returns the memory currently being used by the Flash Player. It’s in bytes so it pays to clean it up slightly.

[as]
var mem:String = Number( System.totalMemory / 1024 / 1024 ).toFixed( 2 ) + ‘Mb’;
trace( mem ); // eg traces “24.94Mb”
[/as]

It seems this takes account of all instances of the flash player. For example, I have a logger/debug panel running in the sidebar of firefox, built in flex. As soon as I open this and it’s initialised, it uses an extra 5 – 10mb of ram. So be warned, if you see a massive increase in memory usage, check you don’t have loads of sites open with ad banners or other flash based stuff.

Back from Flash on the Beach


photo by BIT-101
I got back from Brighton yesterday, exhausted after 3 days of excellent sessions and some heavy drinking sessions too!

The high points for me were Mario Klingemann’s “2D or not 2D, that is the question” talk about working with BitmapData. He showed how to make a “Magic Wand” tool a la photoshop. His process was impressive to say the least, and I’m very interested in playing with the paletteMap method of the BitmapData class.

The session from André Michelle was amazing, he demoed his PopForge sound synthesis engine. Generating sound entirely within flash at run-time. See the video below, this is all generated and manipulated in flash. It’s simply amazing, I can’t wait to get some time (after this post) to start messing around with sound in flash.

Read more…