I knew for a long time now that flash had undocumented features, little part of flash that could help speed up process (like the memory opcodes) or make interaction easy with right click and that kind of things. But I never thought that FlashPlayer would hide data that could help find bugs, or give better knowledge of how flash is interpreted.

As you may know, The mm.cfg files is located in:

Windows; C:\Documents and Settings\username\mm.cfg

OSX; /Library/Application Support/Macromedia/mm.cfg

Linux; home/username/mm.cfg

This file is interpreted when a Flash Player instance launches a SWF and gives indication of what should or shouldn’t be done.
For example, most people use this file to set tracing parameters:
ErrorReportingEnable=1
TraceOutputFileEnable=1
TraceOutputFileName=c:\logs\flashlogs.txt
MaxWarnings=50

Many other options are specified in the Adobe FlashPlayer Admin Guide… but most of is NOT DOCUMENTED!

There is a LOT of thing to talk about and many cutting edge tools to improve your understanding of flash.

So let’s get into it

The Treasure

The complete list of features of mm.cfg is at the end of the post, but first lets talk about what’s most interesting.
I took my favorite 7 features and made detailed explanation with example for each one so here they are:

TraceOutputBuffered = 1|0

This feature is essential to the rest of all the cool features because they output A LOT of lines in the flashlog

This is a very simple features but it change everything. Did you ever had problem tracing to many information and losing half of it in the flashlog?
Well this is a known bug. If you make a loop of 1 000 000 and you trace the iterator, the flashlog will skip thousand of entries and will take 100% of your CPU while writing to disk.
If you set this variable to true, the traces will be buffered and the write to disk will output multiple lines in one access.
Performance? By default (without this feature), I’m able to trace 3600 line in 6 seconds and my CPU is at 100%.
If I turn the features on, I can trace 1 000 000 lines in the same time! And my CPU is not even near 100%.

AS3Verbose = 1|0

This one is totally crazy.
It traces detailed information about SWF ByteCode structure and Runtime parsing of the bytecode!
You don’t need any software… no special framework to bind in your own SWF… just this one flag!

AS3StaticProfile = 1|0

It gives detailed information on function conversion, bytecode conversion, MIR (machine-dependent intermediate representation) created, memory used and many others.
At the end of execution, it also output a summary of all bytecode processed (For each opcode you have the number of occurrence, relatives importance, etc)

AS3DynamicProfile = 1|0

This one give dynamic information about the opcodes being called and gives statistic for each.
The statistics include count, cycles, %count, %times and CPI

My question is: Having access to the CPI (Cycle per instruction) will we be able to conclude all
fights between what operation is faster that the others? Cycle counts does not lies (on the same platform…)* Request for Jackson Dunstan: Wanna work on that? :) *
But there is a problem with this one, it crash all the time.
My guess is it can’t process “Flash Object” like Movieclip, Event, and all the other and only support operation valid in tamarin.

LogGPU = 1|0

This enable logging GPU information about current SWF while it runs.
Use GPULogOutputFileName = [path] to specify where to output that log.
Use DisplayGPUBlend = 1 to display the little green square while GPU runs
use ForceGPUBlend = 1 (At your own risk) to force GPU event if your videocard is not officially listed as valid for Flash GPU.

PreloadSwf?flashvar1=value&…

This is mainly used by the FlashBuilder Profiler. When you launch a SWF profiling, FlashBuilder add this line to mm.cfg to make it run another SWF before the one you profile.
The default file is: C:/Documents and Settings/{USER}/My Documents/Flex Builder 3/.metadata/.plugins/com.adobe.flash.profiler/ProfilerAgent.swf?host=localhost&port=9999
The profiler agent is a SWF that use the as3 sampling classes to collect information and send them all over a socket connection to FlashBuilder.
FlashBuilder is only interpreting that data received from the SWF
By changing localhost by any other machine name you can connect to a remote FlashBuilder Profiler. On the Remote profiler you need to check the “wait for application” box and then start the local SWF on the other machine.

Lets you specify whether SWF files produced for Flash Player 6 and earlier can execute an operation that has been restricted in a newer version of Flash Player.

LocalFileLegacyAction = 1|0

Lets you specify how Flash Player determines whether to execute certain local SWF files that were originally produced for Flash Player 7 and earlier.

LocalFileReadDisable = 1|0

Lets you prevent local SWF files from having read access to files on local hard drives.

LocalStorageLimit = X

Lets you specify a hard limit on the amount of local storage that Flash Player uses (per domain) for persistent shared objects.

LogGPU = 1|0

Lets you specify if you want to output debug GPU log

MaxWarnings = X

The default value of the MaxWarnings property is 100. After 100 messages, the debugger version of Flash Player writes a message to the file stating that further error messages will be suppressed.

OverrideGPUValidation = 1|0

Overrides validation of the requirements needed to implement GPU compositing.

OverrideUserInvokedActions = 1|0

??

PolicyFileLog = 1|0

Enables the logging of policy file messages.

PolicyFileLogAppend = 1|0

Set the PolicyFileLogAppend property to 1 to save previous policy file log entries

PreloadSwf?flashvar1=value&…

Lets you specify a SWF to be loaded before the main swf.This is the profiler agent, a little flash app (ProfilerAgent.swf) that connect to the FlexBuilder Profiler via socket (localhost:9999).
FlexBuilder is only interpreting that data.
PreloadSwf=C:/Documents and Settings/{USER}/My Documents/Flex Builder 3/.metadata/.plugins/com.adobe.flash.profiler/ProfilerAgent.swf?host=localhost&port=9999
By changing localhost by any other machine name you can connect to a remote FlashBuilder Profiler. On the Remote profiler you need to check the “wait for application” box and then start the local SWF on the other machine.

ProductDisabled = 1|0

Creates a list of ProductManager applications that users are not permitted to install or launch.

Specify the flash player to use a buffer before writing to disk. If you had problem when tracing tousands of lines and line were skipped, this solve the thing. It’s also a lot faster (1000000 trace in 7 seconds instead of 3200 trace in 7 sec!)

TraceOutputFileEnable = 1|0

Set TraceOutputFileEnable to 1 to enable the debugger version of Flash Player to write trace messages to the log file.

TraceOutputFileName= [path]

(Before Flash 9) Sets the location of the log file. By default, the debugger version of Flash Player writes error messages to a file named flashlog.txt, located in the same directory in which the mm.cfg file is located.

Conclusion

This whole thing opens a new playground for hardcore programmer like me.
A lot can be done with this new information:

Custom Profiling tool using AS3Verbose and AS3Trace modes

Custom Profiling tool using .dat generated by FlashProfiler

Automatic Code performance warning using NanoJIT structure analysis

Guide to performance using CPI (cycle per instruction)

Mapping of profiler using the PreloadSwf features (instead of localhost put any other host that have a valid profiler)

I didn’t have time to work extensively on each features and I may have interpreted incorrectly certain things.
If it’s the case please tell me and I’ll modify this post. If you do test or benchmark using this post information please post them as comment here and I’ll add the benchmark later in the post.

CSE and DCE are acronyms for common compiler optimization techniques. It seems plausible that these may be employed by the Flash virtual machine to optimize the byte-code before executing. If this is the case, though, I can’t guess why this would affect your ability to profile. So I might be crazy.

TraceOutputBuffered is an interesting one; it would appear that it locks the flashlog so that only one instance of the player can write to it at a time; for me this meant if I had a browser open with a Flash App in one of the tabs, my standalone debug player would no longer output to the tracelog.

Wow, these are sweet. I wonder if some of these (particularly AS3StaticProfile) could be combined with a unit testing framework to get very some very detailed low level optimizations going where needed.

So was anything found about the crash that occurs when using AS3DynamicProfile ? I could _really_ use that function, but the debug player (started from FlashDevelop) crashes on startup when that flag is set.

I looked inside my windows XP SP3 After installing Flash Professional CS5 and I did not file the mm.cfg
I then did a windows search for *.cfg and no luck. Any ideas on how do I get Flash CS5 professional to generate this mm.cfg file automatically

thanks for the post man. I’ve updated my flash player 10 debugger today and it started crashing/ responding slowly. I’ve modified the mm.cfg file and it’s working properly now. but I’m a facing a problem now. I’m not able to see any server communication details(php echos) in the output console. Is there any setting for this? Any help would be much appreciated.
cheers.

Does anyone see anything in this list that will suppress warning messages, but not error messages? I’ve looked, but didn’t see anything, but my little brain doesn’t quite grasp everything in this list.

I get the warning: “Warning” ‘flash has no property ‘prototype’ all the time – often multiple times per file – and it’s driving me crazy.

i’m on mac osx snow leopard. Latest flash debug player installed and no mm.cfg file on /Library/Application Support/Macromedia !!! the file is not present on my hard drive. Does someone encountered the same problem ? Thanks.

I freshly installed a CS5 and get several traces “[..] AVMINF: MTHD [..]”. Unfortunately I cannot find a way to disable them. The mm.cfg file was not located on my windows xp under “C:\Documents and Settings\$myuser” so i created one, added the var “AS3Trace=0″ and restarted flash but still traces. Please advise… :)

MAKE SURE YOU USE THE DEBUGGER PLAYER IN THE FOLDER: 10r32_18. I went through several folders working my way back in versions to find a debugger that:
a. didn’t have the excessive trace problem
b. didnt unpack another dmg file which in turn unpacked another dmg.zip….. ad infinitum

To all the over commentors. Blogs could be a lot much better to read when you can keep Your feedback uncomplicated and also to the stage. No-one likes to learn giant feedback when the idea can be conveyed utilizing a not as long comment

I am not sure if this is related, but below is a snippet of what I get when I first open up a file I have been working on. At first it only appeared when I tested the movie and only on the first time I did it. It severely slowed my computer down.

Extremely good content. I basically stumbled upon an individual’s webpage together with desired that will express the fact that I have extremely liked looking through an individual’s blog site together with threads. Anyway I’ll get following an individual’s provide for together with That i intend that will read an individual’s blog site for a second time.

I have a huge application in AS3 and facing a crash problem since some time. I tried using AS3Trace=1 in mm.cfg with and without TraceOutputBuffered=1, but I cannot see all the logs in flashlog as the file size keeps increasing and goes in GBs over time, causing my computer to slow down. Can you please advice as how do I use it properly in order to investigate my crash problem.

WONDERFUL!!! thanks a lot! I’d like to ask: I can’t get any flash debug player version more than 10.1 (10.3.181.23 is actual now) to work – it plays flash content but doesn’t debug flashlog. I’ve tried many versions but everytime I must return back to 10.1 version that works.
Does anyone know where is the problem? Has anyone same problem?

Thanks for the list and the explanation of all those parameters.
I’ve digged into the current version of the debug Flash Player (Linux, 32-bit, 11.2.202.233) and found a couple of changes. Some parameters are missing (not supported … but this might be only due to the platform differences … I guess you analyzed the Windows version) and a few were added.
If somebody is interested, you can take a look at it here:

I’m not sure whether all of these actually work. I just grabbed from the Flash Player shared lib (libflashplayer.so) all strings that were in the same bunch as some known mm.cfg parameters and looked as if they could be parameters themselves. :-)
If just somebody would take the effort to go over them and test each … ;-)