Re: Setting G_SLICE=always_malloc at runtime



On Thu, Jun 07, 2007 at 08:04:08PM +0100, Raja Mukherji wrote:
I'm writing a binding for Gtk to my programming language Wrapl, and
want to make sure that all memory is allocated by the Hans-Boehm
garbage collector. The glib/gobject shared libraries are loaded
dynamically and I call g_mem_set_vtable to change to GC_malloc,
GC_realloc, GC_free, etc. However g_slice doesn't use these. I know
that setting the environment variable G_SLICE to "always_malloc" will
solve this, but I want to do this at runtime, just after the relevant
shared libraries are loaded, but before they are used (basically at
the same time as when I'd call g_mem_set_vtable).
Is this possible?

GSlice is initialized, i.e. it looks at G_SLICE, on the
first use or when thread support is initialized.  So just
set the variable before that.

Yeti

--
http://gwyddion.net/



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