-#define INITIAL_SIZE 1024*1024 /* new pool size */
-#define MAX_POOLS 4 /* maximum number of pools to setup */
+#define INITIAL_SIZE 8192*1024 /* new pool size */
+#define MAX_POOLS 128 /* maximum number of pools to setup */
#define SMALLOC_PRE_RED 0xdeadbeefU
#define SMALLOC_POST_RED 0x5aa55aa5U
unsigned int smalloc_pool_size = INITIAL_SIZE;
#define SMALLOC_PRE_RED 0xdeadbeefU
#define SMALLOC_POST_RED 0x5aa55aa5U
unsigned int smalloc_pool_size = INITIAL_SIZE;
void *map; /* map of blocks */
unsigned int *bitmap; /* blocks free/busy map */
unsigned int free_blocks; /* free blocks */
unsigned int nr_blocks; /* total blocks */
unsigned int next_non_full;
int fd; /* memory backing fd */
void *map; /* map of blocks */
unsigned int *bitmap; /* blocks free/busy map */
unsigned int free_blocks; /* free blocks */
unsigned int nr_blocks; /* total blocks */
unsigned int next_non_full;
int fd; /* memory backing fd */
static struct pool mp[MAX_POOLS];
static unsigned int nr_pools;
static unsigned int last_pool;
static struct pool mp[MAX_POOLS];
static unsigned int nr_pools;
static unsigned int last_pool;
return 0;
out_unlink:
fprintf(stderr, "smalloc: failed adding pool\n");
if (pool->map)
munmap(pool->map, pool->mmap_size);
return 0;
out_unlink:
fprintf(stderr, "smalloc: failed adding pool\n");
if (pool->map)
munmap(pool->map, pool->mmap_size);
ret = add_pool(&mp[0], INITIAL_SIZE);
assert(!ret);
}
static void cleanup_pool(struct pool *pool)
{
ret = add_pool(&mp[0], INITIAL_SIZE);
assert(!ret);
}
static void cleanup_pool(struct pool *pool)
{
if (hdr->prered != SMALLOC_PRE_RED) {
fprintf(stderr, "smalloc pre redzone destroyed!\n");
if (hdr->prered != SMALLOC_PRE_RED) {
fprintf(stderr, "smalloc pre redzone destroyed!\n");