Generated on Sat Feb 7 2015 02:01:28 for Gecode by doxygen 1.8.9.1
memory-config.hpp
Go to the documentation of this file.
1 /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
2 /*
3  * Main authors:
4  * Christian Schulte <schulte@gecode.org>
5  *
6  * Bugfixes provided by:
7  * Zandra Norman
8  *
9  * Copyright:
10  * Christian Schulte, 2008
11  *
12  * Last modified:
13  * $Date: 2013-07-08 17:25:13 +0200 (Mon, 08 Jul 2013) $ by $Author: schulte $
14  * $Revision: 13825 $
15  *
16  * This file is part of Gecode, the generic constraint
17  * development environment:
18  * http://www.gecode.org
19  *
20  * Permission is hereby granted, free of charge, to any person obtaining
21  * a copy of this software and associated documentation files (the
22  * "Software"), to deal in the Software without restriction, including
23  * without limitation the rights to use, copy, modify, merge, publish,
24  * distribute, sublicense, and/or sell copies of the Software, and to
25  * permit persons to whom the Software is furnished to do so, subject to
26  * the following conditions:
27  *
28  * The above copyright notice and this permission notice shall be
29  * included in all copies or substantial portions of the Software.
30  *
31  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
32  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
33  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
34  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
35  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
36  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
37  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
38  *
39  */
40 
41 namespace Gecode {
42 
47  namespace MemoryConfig {
51  const unsigned int n_hc_cache = 4*4;
52 
56  const size_t hcsz_min = 1024;
64  const size_t hcsz_max = 32 * 1024;
71  const int hcsz_inc_ratio = 8;
81  const int hcsz_dec_ratio = 8;
82 
94  const int fl_unit_size = ((sizeof(void*) == 4) ? 2 : 3);
103  const int fl_size_min = ((sizeof(void*) == 4) ? 2 : 2);
112  const int fl_size_max = ((sizeof(void*) == 4) ? 3 : 3);
120  const int fl_refill = 8;
128 #ifndef GECODE_MEMORY_ALIGNMENT
129 #define GECODE_MEMORY_ALIGNMENT 8
130 #endif
131 
138  const size_t region_area_size = 32 * 1024;
139 
141  void align(size_t& s);
142 
143  /*
144  * Alignment
145  *
146  */
147  forceinline void
148  align(size_t& s) {
149  s += ((GECODE_MEMORY_ALIGNMENT -
150  (s & (GECODE_MEMORY_ALIGNMENT - 1))) &
152  }
153 
154  }
155 }
156 
157 // STATISTICS: kernel-memory
const int fl_size_max
Maximal size for free list element.
const unsigned int n_hc_cache
How many heap chunks should be cached at most.
const int hcsz_inc_ratio
Increment ratio for chunk size.
const size_t hcsz_min
Minimal size of a heap chunk requested from the OS.
const size_t hcsz_max
Maximal size of a heap chunk requested from the OS.
const int hcsz_dec_ratio
Decrement ratio for chunk size.
#define GECODE_MEMORY_ALIGNMENT
Memory alignment.
const int fl_refill
Number of free lists elements to allocate.
const int fl_size_min
Minimal size for free list element.
const size_t region_area_size
Size of region area.
#define forceinline
Definition: config.hpp:132
const int fl_unit_size
Unit size for free lists.
Gecode toplevel namespace
void align(size_t &s)
Align size s to the required alignment.