Name

Memory Allocators deprecated way to allocate chunks of memory for GList, GSList and GNode.


Library

glib.lib


Synopsis

#include <glib.h>

GAllocator;
GAllocator* g_allocator_new (const gchar *name, guint n_preallocs);
void g_allocator_free (GAllocator *allocator);

Detailed Description

Prior to 2.10, GAllocator was used as an efficient way to allocate small pieces of memory for use with the GList, GSList and GNode data structures. Since 2.10, it has been completely replaced by the slice allocator and deprecated.


Details

GAllocator

typedef struct _GAllocator GAllocator;
 
Note

Warning: GAllocator is deprecated and should not be used in newly-written code.

The GAllocator struct contains private data. and should only be accessed using the following functions.


g_allocator_new ()

GAllocator* g_allocator_new               (const gchar *name, guint n_preallocs); 

Creates a new GAllocator.

 
Note

Warning: g_allocator_new has been deprecated since version 2.10 and should not be used in newly-written code.
Use the slice allocator instead.

 

name : the name of the GAllocator. This name is used to set the name of the GMemChunk used by the GAllocator, and is only used for debugging.
n_preallocs : the number of elements in each block of memory allocated. Larger blocks mean less calls to g_malloc(), but some memory may be wasted. (GLib uses 128 elements per block by default.) The value must be between 1 and 65535.
Returns : a new GAllocator.

g_allocator_free ()

void        g_allocator_free             (GAllocator *allocator);

Frees all of the memory allocated by the GAllocator.

Note

Warning: g_allocator_free has been deprecated since version 2.10 and should not be used in newly-written code. Use the slice allocator instead

 

allocator: :  a GAllocator. .

Feedback

For additional information or queries on this page send feedback


© 2005-2007 Nokia

Top