ARB
Classes | Macros | Functions | Variables
admalloc.cxx File Reference
#include <unistd.h>
#include <climits>
#include <set>
#include <arb_backtrace.h>
#include "gb_storage.h"
Include dependency graph for admalloc.cxx:

Go to the source code of this file.

Classes

struct  gbm_data
 
struct  gbm_table
 
struct  gbm_pool
 
struct  gbb_freedata
 
struct  gbb_data
 
struct  gbb_Cluster
 
struct  ARBDB_memory_manager
 

Macros

#define GBM_MAGIC   0x74732876
 
#define GBM_SYSTEM_PAGE_SIZE   4096
 
#define GBM_MALLOC_OVERHEAD   32
 
#define GBM_TABLE_SIZE   (GBM_SYSTEM_PAGE_SIZE-GBM_MALLOC_OVERHEAD)
 
#define GBM_ALIGNED   8
 
#define GBM_LD_ALIGNED   3
 
#define GBM_MAX_TABLES   16
 
#define GBM_MAX_SIZE   (GBM_MAX_TABLES*GBM_ALIGNED)
 
#define GBM_MAX_INDEX   256
 
#define GBB_INCR   11
 
#define GBB_CLUSTERS   64
 
#define GBB_ALIGN   GBM_LD_ALIGNED
 
#define GBB_MINSIZE   GBM_MAX_SIZE
 
#define GBB_MAX_TRIALS   4
 
#define GBB_MAGIC   0x67823747
 
#define GBB_HEADER_SIZE   (sizeof(gbb_data)-sizeof(gbb_freedata))
 
#define TEST()
 

Functions

void free_gbm_table (gbm_table *table)
 
void gbm_flush_mem ()
 
void gbm_init_mem ()
 
static void imemerr (const char *why)
 
static int getClusterIndex (size_t size)
 
static void gbm_put_memblk (char *memblk, size_t size)
 
static chargbm_get_memblk (size_t size)
 
void * gbmGetMemImpl (size_t size, long index)
 
void gbmFreeMemImpl (void *data, size_t size, long index)
 
void gbm_debug_mem ()
 

Variables

static struct gbm_pool gbm_pool4idx [GBM_MAX_INDEX]
 
struct {
   char *   old_sbrk
 
gbm_global
 
static struct gbb_Cluster gbb_cluster [GBB_CLUSTERS+1]
 
static bool gbm_mem_initialized = false
 
static ARBDB_memory_manager memman
 

Macro Definition Documentation

#define GBM_MAGIC   0x74732876

Definition at line 28 of file admalloc.cxx.

Referenced by gbmFreeMemImpl(), and gbmGetMemImpl().

#define GBM_SYSTEM_PAGE_SIZE   4096

Definition at line 30 of file admalloc.cxx.

Referenced by gbmGetMemImpl().

#define GBM_MALLOC_OVERHEAD   32

Definition at line 31 of file admalloc.cxx.

#define GBM_TABLE_SIZE   (GBM_SYSTEM_PAGE_SIZE-GBM_MALLOC_OVERHEAD)

Definition at line 32 of file admalloc.cxx.

Referenced by gbmGetMemImpl().

#define GBM_ALIGNED   8

Definition at line 34 of file admalloc.cxx.

Referenced by gbm_debug_mem(), gbmFreeMemImpl(), and gbmGetMemImpl().

#define GBM_LD_ALIGNED   3

Definition at line 35 of file admalloc.cxx.

Referenced by gbmFreeMemImpl(), and gbmGetMemImpl().

#define GBM_MAX_TABLES   16

Definition at line 37 of file admalloc.cxx.

Referenced by gbm_debug_mem(), and gbm_flush_mem().

#define GBM_MAX_SIZE   (GBM_MAX_TABLES*GBM_ALIGNED)

Definition at line 38 of file admalloc.cxx.

Referenced by gbmFreeMemImpl(), and gbmGetMemImpl().

#define GBM_MAX_INDEX   256
#define GBB_INCR   11

Definition at line 69 of file admalloc.cxx.

Referenced by gbm_init_mem().

#define GBB_CLUSTERS   64

Definition at line 70 of file admalloc.cxx.

Referenced by gbm_get_memblk(), gbm_init_mem(), gbm_put_memblk(), and getClusterIndex().

#define GBB_ALIGN   GBM_LD_ALIGNED

Definition at line 71 of file admalloc.cxx.

Referenced by gbm_init_mem().

#define GBB_MINSIZE   GBM_MAX_SIZE

Definition at line 72 of file admalloc.cxx.

Referenced by gbm_init_mem(), gbm_put_memblk(), gbmFreeMemImpl(), and getClusterIndex().

#define GBB_MAX_TRIALS   4

Definition at line 73 of file admalloc.cxx.

Referenced by gbm_get_memblk().

#define GBB_MAGIC   0x67823747

Definition at line 74 of file admalloc.cxx.

Referenced by gbm_get_memblk(), and gbm_put_memblk().

#define GBB_HEADER_SIZE   (sizeof(gbb_data)-sizeof(gbb_freedata))

Definition at line 90 of file admalloc.cxx.

Referenced by gbm_get_memblk(), gbm_put_memblk(), and gbmFreeMemImpl().

#define TEST ( )

Definition at line 295 of file admalloc.cxx.

Referenced by gbm_get_memblk(), and gbm_put_memblk().

Function Documentation

void free_gbm_table ( gbm_table table)
inline

Definition at line 187 of file admalloc.cxx.

References gbm_table::next.

Referenced by gbm_flush_mem().

void gbm_flush_mem ( void  )
void gbm_init_mem ( void  )
static void imemerr ( const char why)
static

Definition at line 301 of file admalloc.cxx.

References GB_internal_errorf().

Referenced by gbm_get_memblk(), and gbmFreeMemImpl().

static int getClusterIndex ( size_t  size)
static

Definition at line 306 of file admalloc.cxx.

References gb_assert, gbb_cluster, GBB_CLUSTERS, and GBB_MINSIZE.

Referenced by gbm_get_memblk(), and gbm_put_memblk().

static void gbm_put_memblk ( char memblk,
size_t  size 
)
static
static char* gbm_get_memblk ( size_t  size)
static
void* gbmGetMemImpl ( size_t  size,
long  index 
)
void gbmFreeMemImpl ( void *  data,
size_t  size,
long  index 
)
void gbm_debug_mem ( void  )

Variable Documentation

struct gbm_pool gbm_pool4idx[GBM_MAX_INDEX]
static
char* old_sbrk

Definition at line 65 of file admalloc.cxx.

struct { ... } gbm_global

Referenced by gbm_debug_mem(), and gbm_init_mem().

struct gbb_Cluster gbb_cluster[GBB_CLUSTERS+1]
static
bool gbm_mem_initialized = false
static

Definition at line 196 of file admalloc.cxx.

ARBDB_memory_manager memman
static

Definition at line 271 of file admalloc.cxx.