Re: Use of Memory Slices in N-ary Trees
- From: Michael Natterer <mitch gimp org>
- To: Manu Kaul <manu kaul gmail com>
- Cc: Gnome List <gtk-list gnome org>
- Subject: Re: Use of Memory Slices in N-ary Trees
- Date: Fri, 25 Jun 2010 16:15:02 +0200
On Fri, 2010-06-25 at 13:42 +0100, Manu Kaul wrote:
> Ok I understand that its using g_slice_new0, but does this mean that
> it does it just for a single GNode, one at a time?
> What I was after was more like say being able to allocate 100 such
> GNodes at a time upfront if I had a tree with say 5000 nodes in it or
> something, so I am able to get a whole chunk of GNodes at the one
> time!
> Maybe I am misunderstanding something?
You know, this is called "open source" for a reason. In the time spent
here for asking these questions, and the time needed by others to
respond, you could have easily downloaded a glib tarball and simply
look at the code ten times.
ciao,
--mitch
>
> On Fri, Jun 25, 2010 at 1:22 PM, Tadej Borovšak <tadeboro gmail com>
> wrote:
> Hi.
>
> > Ah perfect! So you mean that when I create a new node using
> GNode it will
> > automatically use g_slice_alloc behind the covers?
>
>
> Yes, nodes are allocated using g_slice_new0(GNode) (unless you
> have
> G_SLICE env variable set to "always-malloc").
>
>
> Tadej
>
> --
> Tadej Borovšak
> tadeboro.blogspot.com
> tadeboro gmail com
> tadej borovsak gmail com
>
>
>
>
> --
>
> The greater danger for most of us lies not in setting our aim too high
> and falling short; but in setting our aim too low, and achieving our
> mark.
> - Michelangelo
>
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]