Wireshark-dev: Re: [Wireshark-dev] Should we use the slice allocator instead of GMemChunk in tv

From: Stephen Fisher <stephentfisher@xxxxxxxxx>
Date: Sun, 16 Nov 2008 11:53:16 -0700
On Sun, Nov 16, 2008 at 07:27:42PM +0100, Anders Broman wrote:

> GMemChunk is depreciated should we use the new Slice allocator 
> instead? 

I would say yes, but the slice allocator is only available in GLib 2.10 
and up.  Fortunately, in newer GLib versions, everything has been 
changed to the slice allocator behind the scenes.  For example (from 
glib-2.18.2/glib/gmem.c):

GMemChunk*
g_mem_chunk_new (const gchar  *name,
                 gint          atom_size,
                 gsize         area_size,
                 gint          type)
{
  GMemChunk *mem_chunk;
  g_return_val_if_fail (atom_size > 0, NULL);

  mem_chunk = g_slice_new (GMemChunk);
  mem_chunk->alloc_size = atom_size;
  return mem_chunk;
}


Steve