chiark / gitweb /
Enable gc_mem_gc_friendly ad G_SLICE_CONFIG_ALWAYS_MALLOC, the latter
authorRichard Kettlewell <rjk@greenend.org.uk>
Tue, 3 Jul 2007 23:39:33 +0000 (00:39 +0100)
committerRichard Kettlewell <rjk@greenend.org.uk>
Tue, 3 Jul 2007 23:39:33 +0000 (00:39 +0100)
turning out to be critical for running GTK+ and libgc together.

.bzrignore
disobedience/disobedience.c

index 24e1ed6a98444a8087520e08e193b6d0dafed54c..a931754dce3cd8354afd80579b5108be0f5f4f8a 100644 (file)
@@ -85,3 +85,4 @@ sounds/Makefile
 templates/Makefile
 .bzr.backup
 doc/disorder-speaker.8.html
+.gdb_history
index 8826f4c8a46dd65051a92db6b9269503af76435b..28eeeff4c722856d9286574ee0d41c15fec37edb 100644 (file)
@@ -330,6 +330,11 @@ int main(int argc, char **argv) {
 
   mem_init(1);
   if(!setlocale(LC_CTYPE, "")) fatal(errno, "error calling setlocale");
+  /* Causes GTK+ to 0-fill lots of things, which helps the garbage collector. */
+  g_mem_gc_friendly = 1;
+  /* Causes GTK+ to always use g_malloc() instead of private allocator that
+   * libgc doesn't know about */
+  g_slice_set_config(G_SLICE_CONFIG_ALWAYS_MALLOC, 1);
   /* GLib sucks - not const-correct */
   g_mem_set_vtable((GMemVTable *)&glib_memvtable);
   gtk_init(&argc, &argv);