Gecode::Kernel::MemoryConfig Namespace Reference
Common functionality » Memory management » Space-memory management

Parameters defining memory management policy for spaces. More...

## Functions

void | align (size_t &s, size_t a=GECODE_MEMORY_ALIGNMENT)
| Align size s to the required alignment a.

## Variables

const unsigned int | n_hc_cache = 4*4
| How many heap chunks should be cached at most.
const size_t | hcsz_min = 1024
| Minimal size of a heap chunk requested from the OS.
const size_t | hcsz_max = 32 * 1024
| Maximal size of a heap chunk requested from the OS.
const int | hcsz_inc_ratio = 8
| Increment ratio for chunk size.
const int | hcsz_dec_ratio = 8
| Decrement ratio for chunk size.
const int | fl_unit_size = ((sizeof(void*) == 4) ? 2 : 3)
| Unit size for free lists.
const int | fl_size_min = ((sizeof(void*) == 4) ? 2 : 2)
| Minimal size for free list element.
const int | fl_size_max = ((sizeof(void*) == 4) ? 3 : 3)
| Maximal size for free list element.
const int | fl_refill = 8
| Number of free lists elements to allocate.
const size_t | region_area_size = 32 * 1024
| Size of region area.

## Detailed Description

Parameters defining memory management policy for spaces.

## Function Documentation

## align()

void Gecode::Kernel::MemoryConfig::align | ( | size_t & | s,
|  | size_t | a = GECODE_MEMORY_ALIGNMENT )

inline

Align size s to the required alignment a.

Definition at line 144 of file config.hpp.

## Variable Documentation

## n_hc_cache

const unsigned int Gecode::Kernel::MemoryConfig::n_hc_cache = 4*4

How many heap chunks should be cached at most.

Definition at line 47 of file config.hpp.

## hcsz_min

const size_t Gecode::Kernel::MemoryConfig::hcsz_min = 1024

Minimal size of a heap chunk requested from the OS.

Definition at line 52 of file config.hpp.

## hcsz_max

const size_t Gecode::Kernel::MemoryConfig::hcsz_max = 32 * 1024

Maximal size of a heap chunk requested from the OS.

Maximal is not strictly true, if a contiguous memory chunk is requested that exceeds hcsz_max, a chunk will be allocated that fits that request.

Definition at line 60 of file config.hpp.

## hcsz_inc_ratio

const int Gecode::Kernel::MemoryConfig::hcsz_inc_ratio = 8

Increment ratio for chunk size.

If a space has requested hcsz_inc_ratio chunks of heap memory, the chunk size is doubled.

Definition at line 67 of file config.hpp.

## hcsz_dec_ratio

const int Gecode::Kernel::MemoryConfig::hcsz_dec_ratio = 8

Decrement ratio for chunk size.

When a space is cloned, the new clone normally inherits the current chunk size from the original space. However, if the original space has requested less than hcsz_dec_ratio heap chunks of the current chunk size, the current chunk size for the clone is halfed.

Definition at line 77 of file config.hpp.

## fl_unit_size

const int Gecode::Kernel::MemoryConfig::fl_unit_size = ((sizeof(void*) == 4) ? 2 : 3)

Unit size for free lists.

The unit size (given as binary logarithm) defines how big a unit of memory for free lists is. Also, it defines the alignment. Sizes of free list objects must be multiples of the unit size.

Currently, for 32 bit machines, the unit size is 4 bytes. For 64 bit machines, it is 8 bytes.

Definition at line 90 of file config.hpp.

## fl_size_min

const int Gecode::Kernel::MemoryConfig::fl_size_min = ((sizeof(void*) == 4) ? 2 : 2)

Minimal size for free list element.

The minimal size is given in the number of free list units.

Currently, for 32 bit machines, the minimal size is 8 bytes. For 64 bit machines, it is 16 bytes.

Definition at line 99 of file config.hpp.

## fl_size_max

const int Gecode::Kernel::MemoryConfig::fl_size_max = ((sizeof(void*) == 4) ? 3 : 3)

Maximal size for free list element.

The maximal size is given in the number of free list units.

Currently, for 32 bit machines, the maximal size is 12 bytes. For 64 bit machines, it is 24 bytes.

Definition at line 108 of file config.hpp.

## fl_refill

const int Gecode::Kernel::MemoryConfig::fl_refill = 8

Number of free lists elements to allocate.

When a request for a free list element can not be fulfilled, as the free list is empty and there is also no reusable memory available, allocate fl_refill free list elements.

Definition at line 116 of file config.hpp.

## region_area_size

const size_t Gecode::Kernel::MemoryConfig::region_area_size = 32 * 1024

Size of region area.

The region area can be used in a stack fashion through access from a space. If the a request exceeds the current free space, memory will be allocated from the heap.

Definition at line 134 of file config.hpp.