Atrinik Server 2.5
Data Structures | Defines | Typedefs | Variables
include/mempool.h File Reference

Go to the source code of this file.

Data Structures

struct  mempool_chunk
struct  mempool
struct  puddle_info

Defines

#define MEMPOOL_TRACKING
#define MEMPOOL_NROF_FREELISTS   8
#define MEMPOOL_MAX_ARRAYSIZE   (1 << MEMPOOL_NROF_FREELISTS)
#define MAX_NROF_MEMPOOLS   32
#define MEM_POOLDATA(ptr)   (((struct mempool_chunk *)(ptr)) - 1)
#define MEM_USERDATA(ptr)   ((void *)(((struct mempool_chunk *)(ptr)) + 1))
#define CHUNK_FREE(ptr)   (MEM_POOLDATA(ptr)->next != NULL)
#define MEMPOOL_ALLOW_FREEING   1
#define MEMPOOL_BYPASS_POOLS   2
#define get_poolchunk(_pool_)   get_poolchunk_array_real((_pool_), 0)
#define get_poolarray(_pool_, _arraysize_)   get_poolchunk_array_real((_pool_), nearest_pow_two_exp(_arraysize_))
#define return_poolchunk(_data_, _pool_)   return_poolchunk_array_real((_data_), 0, (_pool_))
#define return_poolarray(_data_, _arraysize_, _pool_)   return_poolchunk_array_real((_data_), nearest_pow_two_exp(_arraysize_), (_pool_))

Typedefs

typedef void(* chunk_initialisator )(void *ptr)
typedef void(* chunk_deinitialisator )(void *ptr)
typedef void(* chunk_constructor )(void *ptr)
typedef void(* chunk_destructor )(void *ptr)

Variables

struct mempoolpool_puddle
struct mempoolmempools []
struct mempool_chunk end_marker
struct mempoolpool_object
struct mempoolpool_objectlink
struct mempoolpool_player
struct mempoolpool_bans
struct mempoolpool_parties
int nrof_mempools

Detailed Description

Memory pooling definitions.

Definition in file mempool.h.


Define Documentation

#define CHUNK_FREE (   ptr)    (MEM_POOLDATA(ptr)->next != NULL)

Check that a chunk of memory is in the free (or removed for objects) list

Definition at line 164 of file mempool.h.

#define MAX_NROF_MEMPOOLS   32

Maximum number of mempools we will use

Definition at line 157 of file mempool.h.

#define MEM_POOLDATA (   ptr)    (((struct mempool_chunk *)(ptr)) - 1)

Get the memory management struct for a chunk of memory

Definition at line 160 of file mempool.h.

#define MEM_USERDATA (   ptr)    ((void *)(((struct mempool_chunk *)(ptr)) + 1))

Get the actual user data area from a mempool reference

Definition at line 162 of file mempool.h.

#define MEMPOOL_TRACKING

Enable tracking/freeing of mempools?

Definition at line 34 of file mempool.h.


Variable Documentation

The removedlist is not ended by NULL, but by a pointer to the end_marker.

Only used as an end marker for the lists

Definition at line 75 of file mempool.c.