Re: [Vala] [vala] how to call mem_set_vtable?



Yes. I realized that too late. I already sent a patch to Jürg on
Saturday. But as you seem to need it now I'll also post it here on the
mailing list. 

This patch swaps the generation of the g_thread_init and the
g_mem_set_vtable.
This is needed for multithreaded programs.
Regards Jörn


Am Montag, den 11.01.2010, 12:02 +0800 schrieb xiaohu:
I just try it, the generated code has little problem. as below:

int main (int argc, char ** argv) {
        g_thread_init (NULL);
        g_mem_set_vtable (glib_mem_profiler_table);
        g_type_init (); 
        return eshare_main_main (argv, argc);
}

g_mem_set_vtable (...) should be called before g_thread_init().

thanks!

在 2010-01-09六的 17:06 +0100,JM写道: 
I wrote a patch for this. This patch has just been added to vala git.
Now, you can set the default table via commandline switch.
Regards 
Jörn

Am Sonntag, den 13.12.2009, 12:39 +0000 schrieb xiaohu:
vala code:

int main ()
{
  mem_set_vtable (mem_profiler_table);
  return 0;
}

will generate:

#include <glib.h>
#include <glib-object.h>

gint _main (void);

gint _main (void) {
        gint result;
        g_mem_set_vtable (glib_mem_profiler_table);
        result = 0;
        return result;
}

int main (int argc, char ** argv) {
        g_type_init (); 
        return _main (); 
}

there has a problem, g_mem_set_vtable () must be called before using any
other GLib functions.

How to call mem_set_vtable ?
_______________________________________________
Vala-list mailing list
Vala-list gnome org
http://mail.gnome.org/mailman/listinfo/vala-list



Attachment: enable-mem-profile_2.patch
Description: Text Data



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]