// EPool: Entry related memory pools
-GMemChunk *mem_chunk_epool;
#ifdef EPOOL_DEBUG
int ep_allocated;
typedef struct _EPool EPool;
struct _EPool {
- SList *blocks; // allocated usiing mem_chunk_epool
+ SList *blocks; // allocated usiing g_slice_alloc(EPOOL_BLOCK_SIZE)
SList *mblocks; // allocated use g_malloc
int cpos;
#ifdef EPOOL_DEBUG
gpointer data;
SList *blocks;
- data = g_mem_chunk_alloc0 (mem_chunk_epool);
+ data = g_slice_alloc0(EPOOL_BLOCK_SIZE);
blocks = (SList *)data;
#ifdef EPOOL_DEBUG
while (l) {
data = l->data;
l = l->next;
- g_mem_chunk_free (mem_chunk_epool, data);
+ g_slice_free1(EPOOL_BLOCK_SIZE, data);
}
}
} else {
SList *blocks = ep->blocks->data + ep->cpos;
- data = g_mem_chunk_alloc0 (mem_chunk_epool);
+ data = g_slice_alloc0 (EPOOL_BLOCK_SIZE);
blocks->data = data;
blocks->next = ep->blocks;
SList *blocks;
int cpos;
- sentry = (SEntry *)g_mem_chunk_alloc0 (mem_chunk_epool);
+ sentry = (SEntry *)g_slice_alloc0(EPOOL_BLOCK_SIZE);
sentry->pid = pid;
#ifdef EPOOL_DEBUG
while (l) {
data = l->data;
l = l->next;
- g_mem_chunk_free (mem_chunk_epool, data);
+ g_slice_free1(EPOOL_BLOCK_SIZE, data);
}
}
int cpos;
char *qid_cp;
- qentry = (QEntry *)g_mem_chunk_alloc0 (mem_chunk_epool);
+ qentry = (QEntry *)g_slice_alloc0(EPOOL_BLOCK_SIZE);
#ifdef EPOOL_DEBUG
qentry->ep.allocated += EPOOL_BLOCK_SIZE;
while (l) {
data = l->data;
l = l->next;
- g_mem_chunk_free (mem_chunk_epool, data);
+ g_slice_free1(EPOOL_BLOCK_SIZE, data);
}
}
int cpos;
char *logid_cp;
- fentry = (FEntry *)g_mem_chunk_alloc0 (mem_chunk_epool);
+ fentry = (FEntry *)g_slice_alloc0(EPOOL_BLOCK_SIZE);
#ifdef EPOOL_DEBUG
fentry->ep.allocated += EPOOL_BLOCK_SIZE;
while (l) {
data = l->data;
l = l->next;
- g_mem_chunk_free (mem_chunk_epool, data);
+ g_slice_free1(EPOOL_BLOCK_SIZE, data);
}
}
filter_debug_free = g_hash_table_new (g_direct_hash, g_direct_equal);
#endif
- if (!(mem_chunk_epool = g_mem_chunk_new ("EPOOL", EPOOL_BLOCK_SIZE,
- 1000*EPOOL_BLOCK_SIZE,
- G_ALLOC_AND_FREE))) {
- fprintf (stderr, "unable to initialize epool\n");
- exit (-1);
- }
-
if (!(parser = parser_new ())) {
fprintf (stderr, "unable to alloc parser structure\n");
exit (-1);