root/branches/cu-security-branch/src/io/bmi/bmi_zoid/zbmi_pool.c @ 8397

Revision 8397, 1.1 KB (checked in by nlmills, 3 years ago)

initial merge with Orange-Branch. much will be broken

Line 
1#define ONLY_MSPACES 1
2#define MSPACES 1
3#define MALLOC_ALIGNMENT 16
4#define USE_LOCKS 1
5/* HAVE_MORECORE defaults to 0 if ONLY_MSPACES is used. */
6#define HAVE_MMAP 0
7
8/*
9 * Avoid duplicate symbol errors when compiling
10 *  with ZeptoOS mpi compilers
11 */
12#pragma weak destroy_mspace
13#pragma weak mspace_independent_comalloc
14#pragma weak mspace_memalign
15#pragma weak mspace_mallinfo
16#pragma weak mspace_calloc
17#pragma weak mspace_max_footprint
18#pragma weak mspace_free
19#pragma weak mspace_mallopt
20#pragma weak mspace_independent_calloc
21#pragma weak create_mspace_with_base
22#pragma weak mspace_realloc
23#pragma weak mspace_malloc
24#pragma weak mspace_trim
25#pragma weak mspace_malloc_stats
26#pragma weak create_mspace
27#pragma weak mspace_footprint
28
29//#include "dlmalloc.h"
30#include "dlmalloc.c"
31
32static mspace pool = NULL;
33
34void
35zbmi_pool_init(void* start, size_t len)
36{
37    pool = create_mspace_with_base(start, len, 1);
38}
39
40void zbmi_pool_fini(void)
41{
42    destroy_mspace(pool);
43    pool = NULL;
44}
45
46void*
47zbmi_pool_malloc(size_t bytes)
48{
49    return mspace_malloc(pool, bytes);
50}
51
52void
53zbmi_pool_free(void* mem)
54{
55    mspace_free(pool, mem);
56}
Note: See TracBrowser for help on using the browser.