Re: landing g_slice_*() in glib



On Fri, 2 Dec 2005, Paul LeoNerd Evans wrote:

On Fri, 02 Dec 2005 09:44:04 +0100
Alexander Larsson <alexl redhat com> wrote:

Also, are you making GType use g_slice for allocation of objects instead
of memchunks (if n_preallocs is set)?

And what of the allocators used by GString / GList / GSlist / ...? Will
they be using g_slice now too..?

$ grep g_slice_[an] *.c
garray.c:  GRealArray *array = g_slice_new (GRealArray);
garray.c:  GRealPtrArray *array = g_slice_new (GRealPtrArray);
gcache.c:  GCacheNode *node = g_slice_new (GCacheNode);
gcache.c:  cache = g_slice_new (GCache);
gdataset.c:      list = g_slice_new (GData);
gdataset.c:      dataset = g_slice_new (GDataset);
ghash.c:  hash_table = g_slice_new (GHashTable);
ghash.c:  GHashNode *hash_node = g_slice_new (GHashNode);
ghook.c:  hook = g_slice_alloc0 (hook_list->hook_size);
glist.c:#define _g_list_alloc0()        g_slice_new0 (GList)
gmain.c:  GPollRec *newrec = g_slice_new (GPollRec);
gmem.c:  mem_chunk = g_slice_new (GMemChunk);
gmem.c:  return g_slice_alloc (mem_chunk->alloc_size);
gmem.c:  return g_slice_alloc0 (mem_chunk->alloc_size);
gnode.c:#define g_node_alloc0()         g_slice_new0 (GNode)
gqueue.c:  return g_slice_new0 (GQueue);
grel.c:  gpointer* tuple = g_slice_alloc (relation->fields * sizeof (gpointer));
grel.c:  gpointer *tuple = g_slice_alloc (relation->fields * sizeof (gpointer));
gslist.c:#define _g_slist_alloc0()       g_slice_new0 (GSList)
gstring.c:  GString *string = g_slice_new (GString);
gtree.c:  GTreeNode *node = g_slice_new (GTreeNode);

and in gobject:

$ grep g_slice_[an] *.c
gsignal.c:  node = g_slice_new (HandlerMatch);
gsignal.c:  Handler *handler = g_slice_new (Handler);
gtype.c:  instance = g_slice_alloc0 (total_size);

so all GType instances (objects) are created via g_slice_*() as well.


--
Paul "LeoNerd" Evans

---
ciaoTJ



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