ARB
|
#include <unistd.h>
#include <climits>
#include <set>
#include <arb_backtrace.h>
#include "gb_storage.h"
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 char * | gbm_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 |
#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 |
Definition at line 39 of file admalloc.cxx.
Referenced by gbm_debug_mem(), gbm_flush_mem(), gbm_init_mem(), gbmFreeMemImpl(), and gbmGetMemImpl().
#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().
|
inline |
Definition at line 187 of file admalloc.cxx.
References gbm_table::next.
Referenced by gbm_flush_mem().
void gbm_flush_mem | ( | void | ) |
Definition at line 198 of file admalloc.cxx.
References gbm_pool::first, free_gbm_table(), gb_assert, GBM_MAX_INDEX, GBM_MAX_TABLES, gbm_pool4idx, and gbm_pool::useditems.
Referenced by GB_exit_gb(), and ARBDB_memory_manager::~ARBDB_memory_manager().
void gbm_init_mem | ( | void | ) |
Definition at line 219 of file admalloc.cxx.
References gbb_Cluster::first, GBB_ALIGN, gbb_cluster, GBB_CLUSTERS, GBB_INCR, GBB_MINSIZE, gbm_global, GBM_MAX_INDEX, gbm_pool4idx, NULp, gbb_Cluster::size, and gbm_pool::tables.
Referenced by ARBDB_memory_manager::ARBDB_memory_manager(), and GB_init_gb().
|
static |
Definition at line 301 of file admalloc.cxx.
References GB_internal_errorf().
Referenced by gbm_get_memblk(), and gbmFreeMemImpl().
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().
Definition at line 326 of file admalloc.cxx.
References gbb_data::allocFromSystem, block, gbb_data::content, gbb_Cluster::first, gb_assert, GB_internal_errorf(), gbb_cluster, GBB_CLUSTERS, GBB_HEADER_SIZE, GBB_MAGIC, GBB_MINSIZE, getClusterIndex(), gbb_freedata::magic, gbb_freedata::next, gbb_data::size, gbb_Cluster::size, and TEST.
Referenced by gbmFreeMemImpl().
Definition at line 364 of file admalloc.cxx.
References gbb_data::allocFromSystem, gbb_data::content, gbb_Cluster::first, gb_assert, gbb_cluster, GBB_CLUSTERS, GBB_HEADER_SIZE, GBB_MAGIC, GBB_MAX_TRIALS, getClusterIndex(), imemerr(), gbb_freedata::magic, gbb_freedata::next, NULp, gbb_data::size, gbb_Cluster::size, and TEST.
Referenced by gbmGetMemImpl().
Definition at line 431 of file admalloc.cxx.
References arb_mem::alloc_aligned(), gbm_pool::allsize, gbm_table::data, gbm_pool::extern_data_items, gbm_pool::extern_data_size, gbm_pool::first, GB_internal_error(), GBM_ALIGNED, gbm_get_memblk(), GBM_LD_ALIGNED, GBM_MAGIC, GBM_MAX_INDEX, GBM_MAX_SIZE, gbm_pool4idx, GBM_SYSTEM_PAGE_SIZE, GBM_TABLE_SIZE, gbm_pool::gds, gbm_data::magic, gbm_data::next, gbm_table::next, result, gbm_pool::size, gbm_pool::tablecnt, gbm_pool::tables, and gbm_pool::useditems.
Referenced by gbm_get_mem().
Definition at line 485 of file admalloc.cxx.
References gbb_data::allocFromSystem, block, gbm_pool::extern_data_items, gbm_pool::extern_data_size, gb_isMappedMemory(), GBB_HEADER_SIZE, GBB_MINSIZE, GBM_ALIGNED, GBM_LD_ALIGNED, GBM_MAGIC, GBM_MAX_INDEX, GBM_MAX_SIZE, gbm_pool4idx, gbm_put_memblk(), imemerr(), gbm_data::magic, gbm_data::next, gbb_data::size, gbm_pool::tablecnt, gbm_pool::tables, and gbm_pool::useditems.
Referenced by gbm_free_mem().
void gbm_debug_mem | ( | void | ) |
Definition at line 549 of file admalloc.cxx.
References gbm_pool::extern_data_items, gbm_pool::extern_data_size, GBM_ALIGNED, gbm_global, GBM_MAX_INDEX, GBM_MAX_TABLES, gbm_pool4idx, gbm_pool::tablecnt, and gbm_pool::useditems.
Referenced by GB_print_debug_information(), and ARBDB_memory_manager::~ARBDB_memory_manager().
|
static |
Referenced by gbm_debug_mem(), gbm_flush_mem(), gbm_init_mem(), gbmFreeMemImpl(), and gbmGetMemImpl().
char* old_sbrk |
Definition at line 65 of file admalloc.cxx.
struct { ... } gbm_global |
Referenced by gbm_debug_mem(), and gbm_init_mem().
|
static |
Referenced by gbm_get_memblk(), gbm_init_mem(), gbm_put_memblk(), and getClusterIndex().
|
static |
Definition at line 196 of file admalloc.cxx.
|
static |
Definition at line 271 of file admalloc.cxx.