Re: Setting G_SLICE=always_malloc at runtime
- From: "Raja Mukherji" <rajamukherji gmail com>
- To: gtk-app-devel-list gnome org
- Subject: Re: Setting G_SLICE=always_malloc at runtime
- Date: Fri, 8 Jun 2007 09:36:44 +0100
Okay, I've figured out why g_slice_set_config wasn't working...at some
point g_quark_from_static_string was being called before
g_slice_set_config, hence the error.
On 6/8/07, Raja Mukherji <rajamukherji gmail com> wrote:
Do I set the environment variable? Because code like
setenv("G_SLICE", "always_malloc", 1);
g_thread_init(0);
doesn;t seem to work.
I noticed the g_slice_set_config functions in gslice.h and tried
g_slice_set_config(G_SLICE_CONFIG_ALWAYS_MALLOC, 1);
but this gives me the error
(process:6533): GLib-CRITICAL **: g_slice_set_config: assertion
`sys_page_size == 0' failed
and also does not work.
What am I doing wrong?
Raja
On 6/7/07, David Nečas (Yeti) <yeti physics muni cz> wrote:
> 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/
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]