Re: Use of Memory Slices in N-ary Trees



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? 

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").



--

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


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