]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/build/src/engine/mem.h
2 * Copyright 2006. Rene Rivera
3 * Distributed under the Boost Software License, Version 1.0.
4 * (See accompanying file LICENSE_1_0.txt or copy at
5 * http://www.boost.org/LICENSE_1_0.txt)
13 /* Use Boehm GC memory allocator. */
16 #define bjam_malloc_x(s) memset(GC_malloc(s),0,s)
17 #define bjam_malloc_atomic_x(s) memset(GC_malloc_atomic(s),0,s)
18 #define bjam_calloc_x(n,s) memset(GC_malloc((n)*(s)),0,(n)*(s))
19 #define bjam_calloc_atomic_x(n,s) memset(GC_malloc_atomic((n)*(s)),0,(n)*(s))
20 #define bjam_realloc_x(p,s) GC_realloc(p,s)
21 #define bjam_free_x(p) GC_free(p)
22 #define bjam_mem_init_x() GC_init(); GC_enable_incremental()
24 #define bjam_malloc_raw_x(s) malloc(s)
25 #define bjam_calloc_raw_x(n,s) calloc(n,s)
26 #define bjam_realloc_raw_x(p,s) realloc(p,s)
27 #define bjam_free_raw_x(p) free(p)
29 #ifndef BJAM_NEWSTR_NO_ALLOCATE
30 # define BJAM_NEWSTR_NO_ALLOCATE
33 #elif defined( OPT_DUMA )
35 /* Use Duma memory debugging library. */
38 #define _DUMA_CONFIG_H_
39 #define DUMA_NO_GLOBAL_MALLOC_FREE
40 #define DUMA_EXPLICIT_INIT
41 #define DUMA_NO_THREAD_SAFETY
42 #define DUMA_NO_CPP_SUPPORT
43 /* #define DUMA_NO_LEAKDETECTION */
44 /* #define DUMA_USE_FRAMENO */
45 /* #define DUMA_PREFER_ATEXIT */
46 /* #define DUMA_OLD_DEL_MACRO */
47 /* #define DUMA_NO_HANG_MSG */
48 #define DUMA_PAGE_SIZE 4096
49 #define DUMA_MIN_ALIGNMENT 1
50 /* #define DUMA_GNU_INIT_ATTR 0 */
51 typedef unsigned int DUMA_ADDR
;
52 typedef unsigned int DUMA_SIZE
;
55 #define bjam_malloc_x(s) malloc(s)
56 #define bjam_calloc_x(n,s) calloc(n,s)
57 #define bjam_realloc_x(p,s) realloc(p,s)
58 #define bjam_free_x(p) free(p)
60 #ifndef BJAM_NEWSTR_NO_ALLOCATE
61 # define BJAM_NEWSTR_NO_ALLOCATE
66 /* Standard C memory allocation. */
69 #define bjam_malloc_x(s) malloc(s)
70 #define bjam_calloc_x(n,s) calloc(n,s)
71 #define bjam_realloc_x(p,s) realloc(p,s)
72 #define bjam_free_x(p) free(p)
76 #ifndef bjam_malloc_atomic_x
77 #define bjam_malloc_atomic_x(s) bjam_malloc_x(s)
79 #ifndef bjam_calloc_atomic_x
80 #define bjam_calloc_atomic_x(n,s) bjam_calloc_x(n,s)
82 #ifndef bjam_mem_init_x
83 #define bjam_mem_init_x()
85 #ifndef bjam_mem_close_x
86 #define bjam_mem_close_x()
88 #ifndef bjam_malloc_raw_x
89 #define bjam_malloc_raw_x(s) bjam_malloc_x(s)
91 #ifndef bjam_calloc_raw_x
92 #define bjam_calloc_raw_x(n,s) bjam_calloc_x(n,s)
94 #ifndef bjam_realloc_raw_x
95 #define bjam_realloc_raw_x(p,s) bjam_realloc_x(p,s)
97 #ifndef bjam_free_raw_x
98 #define bjam_free_raw_x(p) bjam_free_x(p)
101 #ifdef OPT_DEBUG_PROFILE
102 /* Profile tracing of memory allocations. */
105 #define BJAM_MALLOC(s) (profile_memory(s), bjam_malloc_x(s))
106 #define BJAM_MALLOC_ATOMIC(s) (profile_memory(s), bjam_malloc_atomic_x(s))
107 #define BJAM_CALLOC(n,s) (profile_memory(n*s), bjam_calloc_x(n,s))
108 #define BJAM_CALLOC_ATOMIC(n,s) (profile_memory(n*s), bjam_calloc_atomic_x(n,s))
109 #define BJAM_REALLOC(p,s) (profile_memory(s), bjam_realloc_x(p,s))
111 #define BJAM_MALLOC_RAW(s) (profile_memory(s), bjam_malloc_raw_x(s))
112 #define BJAM_CALLOC_RAW(n,s) (profile_memory(n*s), bjam_calloc_raw_x(n,s))
113 #define BJAM_REALLOC_RAW(p,s) (profile_memory(s), bjam_realloc_raw_x(p,s))
115 /* No mem tracing. */
116 #define BJAM_MALLOC(s) bjam_malloc_x(s)
117 #define BJAM_MALLOC_ATOMIC(s) bjam_malloc_atomic_x(s)
118 #define BJAM_CALLOC(n,s) bjam_calloc_x(n,s)
119 #define BJAM_CALLOC_ATOMIC(n,s) bjam_calloc_atomic_x(n,s)
120 #define BJAM_REALLOC(p,s) bjam_realloc_x(p,s)
122 #define BJAM_MALLOC_RAW(s) bjam_malloc_raw_x(s)
123 #define BJAM_CALLOC_RAW(n,s) bjam_calloc_raw_x(n,s)
124 #define BJAM_REALLOC_RAW(p,s) bjam_realloc_raw_x(p,s)
127 #define BJAM_MEM_INIT() bjam_mem_init_x()
128 #define BJAM_MEM_CLOSE() bjam_mem_close_x()
130 #define BJAM_FREE(p) bjam_free_x(p)
131 #define BJAM_FREE_RAW(p) bjam_free_raw_x(p)