108 pool(
size_t n,
size_t initial=100,
size_t growth=1);
109 void init(
size_t n,
size_t initial=100,
size_t growth=1);
126 inline void *
alloc(
void);
127 inline void free(
void*
p);
222 void init(
size_t chunk_size=1048576);
224 void*
alloc(
size_t obj_size);
size_t size_of(void) const
Definition: allocator.h:128
const int MAX_THREAD
Definition: allocator.h:185
pool()
Create pool for objects of size n.
Definition: allocator.cpp:25
size_t size(void)
Definition: allocator.h:76
void init(size_t n, size_t initial=100, size_t growth=1)
Definition: allocator.cpp:65
size_t capacity
number of free elements
Definition: allocator.h:88
bool initialized_
True if the pool is initialized.
Definition: allocator.h:92
Definition: allocator.h:52
char * mem
Definition: allocator.h:62
char * head_
Points to the next free location in the current chunk.
Definition: allocator.h:249
size_t get_instantiations() const
Definition: allocator.h:170
The Fujitsu compiler on K cannot handle OpenMP thread-private properly.
Definition: allocator.h:270
chunk * next_
Definition: allocator.h:213
size_t growth_factor
Definition: allocator.h:82
chunk * chunks_
First element of the linked list of chunks.
Definition: allocator.h:254
void destruct()
Definition: allocator.cpp:167
chunk(size_t s)
Definition: allocator.h:64
A chunk of memory, one element in the linked list of the memory pool.
Definition: allocator.h:209
char padding[64-sizeof(PoorMansAllocator)]
Definition: allocator.h:273
chunk * chunks
linked list of memory chunks
Definition: allocator.h:89
void new_chunk()
Append a new chunk of memory to the list forming the memory pool.
Definition: allocator.cpp:157
chunk(char *mem, chunk *next)
Definition: allocator.h:211
void init(size_t chunk_size=1048576)
No constructors, as this would be counted as a 'use' of the pool before declaring it thread-private b...
Definition: allocator.cpp:149
size_t chunk_size_
The size of each chunk to be allocated.
Definition: allocator.h:240
~chunk()
Definition: allocator.h:70
link * head
head of free list
Definition: allocator.h:90
void grow()
make pool larger
Definition: allocator.cpp:128
size_t available(void) const
Definition: allocator.h:123
size_t instantiations
number of instantiated elements
Definition: allocator.h:86
void * alloc(size_t obj_size)
Definition: allocator.cpp:174
void * alloc(void)
allocate one element
Definition: allocator.h:137
Definition: allocator.h:54
link * next
Definition: allocator.h:52
size_t initial_block_size
Definition: allocator.h:81
void free(void *p)
put element back into the pool
Definition: allocator.h:155
const size_t csize
Definition: allocator.h:56
~pool()
deallocate ALL memory
Definition: allocator.cpp:82
size_t total
total number of allocated elements
Definition: allocator.h:87
The poor man's allocator is a simple pool-based allocator, used to allocate storage for connections i...
Definition: allocator.h:201
void reserve_additional(size_t n)
Increase the pools capacity (free slots) by n.
Definition: allocator.cpp:134
const Name n("n")
Number of synaptic release sites (int >=0) (Tsodyks2_connection)
Definition: nest_names.h:202
size_t get_total() const
Definition: allocator.h:176
chunk & operator=(const chunk &)
not implemented
size_t block_size
number of elements per chunk
Definition: allocator.h:84
pool is a specialized allocator class for many identical small objects.
Definition: allocator.h:50
char * mem_
Definition: allocator.h:211
size_t get_el_size() const
Definition: allocator.h:164
const Name p("p")
current release probability (Tsodyks2_connection)
Definition: nest_names.h:218
chunk * next
Definition: allocator.h:61
pool & operator=(const pool &)
Definition: allocator.cpp:93
size_t el_size
sizeof an element
Definition: allocator.h:85
size_t capacity_
Remaining capacity of the current chunk.
Definition: allocator.h:259
chunk(const chunk &)
not implemented