00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __G_SLICE_H__
00021 #define __G_SLICE_H__
00022
00023 #ifndef __G_MEM_H__
00024 #error Include <glib.h> instead of <gslice.h>
00025 #endif
00026
00027 #include <glib/gtypes.h>
00028
00029 G_BEGIN_DECLS
00030
00031
00032
00033 IMPORT_C gpointer g_slice_alloc (gsize block_size) G_GNUC_MALLOC;
00034 IMPORT_C gpointer g_slice_alloc0 (gsize block_size) G_GNUC_MALLOC;
00035 IMPORT_C void g_slice_free1 (gsize block_size,
00036 gpointer mem_block);
00037 IMPORT_C void g_slice_free_chain_with_offset (gsize block_size,
00038 gpointer mem_chain,
00039 gsize next_offset);
00040 #define g_slice_new(type) ((type*) g_slice_alloc (sizeof (type)))
00041 #define g_slice_new0(type) ((type*) g_slice_alloc0 (sizeof (type)))
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052 #define g_slice_free(type, mem) do { \
00053 if (1) g_slice_free1 (sizeof (type), (mem)); \
00054 else (void) ((type*) 0 == (mem)); \
00055 } while (0)
00056 #define g_slice_free_chain(type, mem_chain, next) do { \
00057 if (1) g_slice_free_chain_with_offset (sizeof (type), \
00058 (mem_chain), G_STRUCT_OFFSET (type, next)); \
00059 else (void) ((type*) 0 == (mem_chain)); \
00060 } while (0)
00061
00062
00063
00064 typedef enum {
00065 G_SLICE_CONFIG_ALWAYS_MALLOC = 1,
00066 G_SLICE_CONFIG_BYPASS_MAGAZINES,
00067 G_SLICE_CONFIG_WORKING_SET_MSECS,
00068 G_SLICE_CONFIG_COLOR_INCREMENT,
00069 G_SLICE_CONFIG_CHUNK_SIZES,
00070 G_SLICE_CONFIG_CONTENTION_COUNTER
00071 } GSliceConfig;
00072 void g_slice_set_config (GSliceConfig ckey, gint64 value);
00073 gint64 g_slice_get_config (GSliceConfig ckey);
00074 gint64* g_slice_get_config_state (GSliceConfig ckey, gint64 address, guint *n_values);
00075
00076 G_END_DECLS
00077
00078 #endif