Re: Setting G_SLICE=always_malloc at runtime

2007-06-08 Thread Raja Mukherji
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 <[EMAIL PROTECTED]> 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) <[EMAIL PROTECTED]> 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
> >
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Setting G_SLICE=always_malloc at runtime

2007-06-07 Thread Raja Mukherji
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) <[EMAIL PROTECTED]> 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
>
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: Setting G_SLICE=always_malloc at runtime

2007-06-07 Thread Yeti
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