22 #include <spot/misc/common.hh> 24 #if SPOT_DEBUG && defined(HAVE_VALGRIND_MEMCHECK_H) 25 #include <valgrind/memcheck.h> 42 chunk_* prev = chunklist_->prev;
43 ::operator
delete(chunklist_);
52 block_* f = freelist_;
56 #if SPOT_DEBUG && defined(HAVE_VALGRIND_MEMCHECK_H) 57 VALGRIND_MALLOCLIKE_BLOCK(f, size_, 0,
false);
60 VALGRIND_MAKE_MEM_DEFINED(f,
sizeof(block_*));
70 if (free_start_ + size_ > free_end_)
72 const size_t requested = (size_ > 128 ? size_ : 128) * 8192 - 64;
73 chunk_* c =
reinterpret_cast<chunk_*
>(::operator
new(requested));
77 free_start_ = c->data_ + size_;
78 free_end_ = c->data_ + requested;
81 void* res = free_start_;
83 #if SPOT_DEBUG && defined(HAVE_VALGRIND_MEMCHECK_H) 84 VALGRIND_MALLOCLIKE_BLOCK(res, size_, 0,
false);
99 block_* b =
reinterpret_cast<block_*
>(ptr);
102 #if SPOT_DEBUG && defined(HAVE_VALGRIND_MEMCHECK_H) 103 VALGRIND_FREELIKE_BLOCK(ptr, 0);
109 struct block_ { block_* next; }* freelist_;
113 union chunk_ { chunk_* prev;
char data_[1]; }* chunklist_;
Definition: automata.hh:26
void * allocate()
Allocate size bytes of memory.
Definition: fixpool.hh:50
~fixed_size_pool()
Free any memory allocated by this pool.
Definition: fixpool.hh:38
void deallocate(void *ptr)
Recycle size bytes of memory.
Definition: fixpool.hh:96
A fixed-size memory pool implementation.
Definition: fixpool.hh:31