40 #ifndef MEMORYBANK_HPP
41 #define MEMORYBANK_HPP
73 __attribute__((hot,fastcall))
75 static void*
allocate(
size_t bytes)
throw (std::bad_alloc);
117 memset(p, 0x55, bytes);
120 if (bytes > s_max_cell_size)
121 ::operator
delete(p);
122 else s_pools[s_pooltab[(bytes + 7) >> 3]].
deallocate(p);
123 --s_blocks_allocated;
124 s_bytes_allocated -= bytes;
135 #ifdef R_MEMORY_PROFILING
153 static void setMonitor(
void (*monitor)(
size_t) = 0,
154 size_t threshold = 0);
158 static const size_t s_num_pools = 10;
159 static const size_t s_max_cell_size;
160 static size_t s_blocks_allocated;
161 static size_t s_bytes_allocated;
162 static Pool* s_pools;
163 static const unsigned char s_pooltab[];
164 #ifdef R_MEMORY_PROFILING
165 static void (*s_monitor)(size_t);
166 static size_t s_monitor_threshold;
174 static void cleanup() {}
177 static void initialize();
179 friend class SchwarzCounter<MemoryBank>;