1.. _Allocator_Configuration:
2
3Configuring the Memory Allocator
4================================
5
6
7The oneTBB memory allocator provides the following API functions and
8environment variables to configure its behavior:
9
10
11-  the ``scalable_allocation_command`` function instructs the allocator
12   to perform a certain action, such as cleaning up its internal memory
13   buffers.
14
15
16-  the ``scalable_allocation_mode`` function allows an application to
17   set certain parameters for the memory allocator, such as an option to
18   map memory in huge pages or define a recommended heap size. These
19   settings take effect until modified by another call to
20   ``scalable_allocation_mode``.
21
22
23Some of the memory allocator parameters can also be set via system
24environment variables. It can be useful to adjust the behavior without
25modifying application source code, to ensure that a setting takes effect
26as early as possible, or to avoid explicit dependency on the oneTBB
27allocator binaries. The following environment variables are recognized:
28
29
30-  ``TBB_MALLOC_USE_HUGE_PAGES`` controls usage of huge pages for memory
31   mapping.
32
33
34-  ``TBB_MALLOC_SET_HUGE_OBJECT_THRESHOLD`` defines the lower bound for
35   the size (bytes), that is interpreted as huge and not released during
36   regular cleanup operations.
37
38
39These variables only take effect at the time the memory manager is
40initialized; later environment changes are ignored. A call to
41``scalable_allocation_mode`` overrides the effect of the corresponding
42environment variable.
43