How do I enable GC Profiling?

Mar 6, 2008 at 6:54 AM
I can see, in GC.CollectBody(), that there is code to print out garbage collection profiling information to the debugger if VTable.enableGCProfiling = true. What is the proper way to enable this flag? I can see that it gets set to true inside of VTable.ParseArgs() if the "--brt-gc-profiling" argument is set, but I can't tell where or how to pass in this argument. As a hack, I inserted the following code at the beginning of VTable.Initialize():

#if MYDEBUGLEVEL
VTable.enableGCProfiling = true;
#endif

At the RDK command prompt, I set the ExtraCompilerFlags environment variable to "/d:MYDEBUGLEVEL" so that the above code will get compiled in. This works ok for the Debug configuration -- I can see the "GC:...." information printed to the debugger. However, this is a very hack-ish way of turning on this trace, and it doesn't work at all for the Prototype configuration. In that configuration, VTable.enableGCProfiling (somehow) is false by the time it is read inside of GC.CollectBody(). I haven't figured that one out yet...

Any help would be appreciated. Thanks.

-Z