var thread_init_call = new CCodeFunctionCall (new CCodeIdentifier ("g_thread_init"));
thread_init_call.line = cmain.line;
thread_init_call.add_argument (new CCodeConstant ("NULL"));
- main_block.add_statement (new CCodeExpressionStatement (thread_init_call));
+ main_block.add_statement (new CCodeExpressionStatement (thread_init_call));
+ }
+
+ if (context.mem_profiler) {
+ var mem_profiler_init_call = new CCodeFunctionCall (new CCodeIdentifier ("g_mem_set_vtable"));
+ mem_profiler_init_call.line = cmain.line;
+ mem_profiler_init_call.add_argument (new CCodeConstant ("glib_mem_profiler_table"));
+ main_block.add_statement (new CCodeExpressionStatement (mem_profiler_init_call));
}
var type_init_call = new CCodeExpressionStatement (new CCodeFunctionCall (new CCodeIdentifier ("g_type_init")));
static string output;
static bool debug;
static bool thread;
+ static bool mem_profiler;
static bool disable_assert;
static bool enable_checking;
static bool deprecated;
{ "output", 'o', 0, OptionArg.FILENAME, ref output, "Place output in file FILE", "FILE" },
{ "debug", 'g', 0, OptionArg.NONE, ref debug, "Produce debug information", null },
{ "thread", 0, 0, OptionArg.NONE, ref thread, "Enable multithreading support", null },
+ { "enable-mem-profiler", 0, 0, OptionArg.NONE, ref mem_profiler, "Enable GLib memory profiler", null },
{ "define", 'D', 0, OptionArg.STRING_ARRAY, ref defines, "Define SYMBOL", "SYMBOL..." },
{ "main", 0, 0, OptionArg.STRING, ref entry_point, "Use SYMBOL as entry point", "SYMBOL..." },
{ "disable-assert", 0, 0, OptionArg.NONE, ref disable_assert, "Disable assertions", null },
}
context.debug = debug;
context.thread = thread;
+ context.mem_profiler = mem_profiler;
context.save_temps = save_temps;
if (profile == "posix") {
context.profile = Profile.POSIX;