config.hpp
Go to the documentation of this file.
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
* Main authors:
* Christian Schulte <schulte@gecode.org>
*
* Bugfixes provided by:
* Zandra Norman
*
* Copyright:
* Christian Schulte, 2008
*
* This file is part of Gecode, the generic constraint
* development environment:
* http://www.gecode.org
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
namespace Gecode { namespace Kernel {
namespace MemoryConfig {
const unsigned int n_hc_cache = 4*4;
const size_t hcsz_min = 1024;
const size_t hcsz_max = 32 * 1024;
const int hcsz_inc_ratio = 8;
const int hcsz_dec_ratio = 8;
const int fl_unit_size = ((sizeof(void*) == 4) ? 2 : 3);
const int fl_size_min = ((sizeof(void*) == 4) ? 2 : 2);
const int fl_size_max = ((sizeof(void*) == 4) ? 3 : 3);
const int fl_refill = 8;
#ifndef GECODE_MEMORY_ALIGNMENT
#define GECODE_MEMORY_ALIGNMENT static_cast<size_t>(8U)
#endif
const size_t region_area_size = 32 * 1024;
void align(size_t& s, size_t a = GECODE_MEMORY_ALIGNMENT);
/*
* Alignment
*
*/
forceinline void
align(size_t& s, size_t a) {
s += ((a - (s & (a - 1))) & (a - 1));
}
}
}}
// STATISTICS: kernel-memory
GECODE_MEMORY_ALIGNMENT
#define GECODE_MEMORY_ALIGNMENT
Memory alignment.
Definition config.hpp:125
Gecode::Kernel::MemoryConfig
Parameters defining memory management policy for spaces.
Definition config.hpp:43
Gecode::Kernel::MemoryConfig::hcsz_inc_ratio
const int hcsz_inc_ratio
Increment ratio for chunk size.
Definition config.hpp:67
Gecode::Kernel::MemoryConfig::hcsz_max
const size_t hcsz_max
Maximal size of a heap chunk requested from the OS.
Definition config.hpp:60
Gecode::Kernel::MemoryConfig::fl_size_max
const int fl_size_max
Maximal size for free list element.
Definition config.hpp:108
Gecode::Kernel::MemoryConfig::align
void align(size_t &s, size_t a=GECODE_MEMORY_ALIGNMENT)
Align size s to the required alignment a.
Definition config.hpp:144
Gecode::Kernel::MemoryConfig::fl_unit_size
const int fl_unit_size
Unit size for free lists.
Definition config.hpp:90
Gecode::Kernel::MemoryConfig::n_hc_cache
const unsigned int n_hc_cache
How many heap chunks should be cached at most.
Definition config.hpp:47
Gecode::Kernel::MemoryConfig::hcsz_min
const size_t hcsz_min
Minimal size of a heap chunk requested from the OS.
Definition config.hpp:52
Gecode::Kernel::MemoryConfig::region_area_size
const size_t region_area_size
Size of region area.
Definition config.hpp:134
Gecode::Kernel::MemoryConfig::fl_refill
const int fl_refill
Number of free lists elements to allocate.
Definition config.hpp:116
Gecode::Kernel::MemoryConfig::fl_size_min
const int fl_size_min
Minimal size for free list element.
Definition config.hpp:99
Gecode::Kernel::MemoryConfig::hcsz_dec_ratio
const int hcsz_dec_ratio
Decrement ratio for chunk size.
Definition config.hpp:77
Gecode::Kernel
Kernel functionality
Gecode
Gecode toplevel namespace
forceinline
#define forceinline
Definition config.hpp:187