38 Region::Pool::Pool(
void)
39 :
c(new Chunk), n_c(2U) {
40 c->next =
new Chunk;
c->next->next =
nullptr;
43 Region::Pool::chunk(
void) {
48 n =
c;
c =
c->next; n_c--;
50 n =
new Region::Chunk;
57 Region::Pool::chunk(Chunk*
u) {
67 Region::Pool::~Pool(
void) {
75 }
while (
c !=
nullptr);
79 Region::Pool& Region::pool(
void) {
80 static Region::Pool _p;
85 Region::heap_alloc(
size_t s) {
91 HeapInfo* h =
static_cast<HeapInfo*
> 92 (
heap.
ralloc(
sizeof(HeapInfo)+(4-1)*
sizeof(
void*)));
94 h->blocks[0]=hi; h->blocks[1]=
p;
98 if (h->n == h->size) {
99 HeapInfo* n =
static_cast<HeapInfo*
> 100 (
heap.
ralloc(
sizeof(HeapInfo)+(2*h->n-1)*
sizeof(
void*)));
103 memcpy(&n->blocks[0], &h->blocks[0], h->n*
sizeof(
void*));
108 h->blocks[h->n++] =
p;
114 Region::heap_free(
void) {
115 assert(hi !=
nullptr);
118 for (
unsigned int i=h->
n;
i--; )
bool marked(void *p)
Check whether p is marked.
void rfree(void *p)
Free memory block starting at p.
void * ralloc(size_t s)
Allocate s bytes from heap.
void * mark(void *p)
Return marked pointer for unmarked pointer p.
Gecode::FloatVal c(-8, 8)
int p
Number of positive literals for node type.
Gecode::IntArgs i(4, 1, 2, 3, 4)
int n
Number of negative literals for node type.
union Gecode::@585::NNF::@62 u
Union depending on nodetype t.
void * unmark(void *p)
Return unmarked pointer for a marked pointer p.
Heap heap
The single global heap.
const unsigned int n_hc_cache
How many heap chunks should be cached at most.
Gecode toplevel namespace