# qopt-malloc-options

Lets you specify an alternate algorithm for malloc().

## Syntax

Linux: | -qopt-malloc-options=n

macOS: | -qopt-malloc-options=n

Windows: | None

## Arguments

n | Specifies the algorithm to use for malloc(). Possible values are:
0 | Tells the compiler to use the default algorithm for malloc(). This is the default.
1 | Causes the following adjustments to the malloc() algorithm: M_MMAP_MAX=2 and M_TRIM_THRESHOLD=0x10000000.
2 | Causes the following adjustments to the malloc() algorithm: M_MMAP_MAX=2 and M_TRIM_THRESHOLD=0x40000000.
3 | Causes the following adjustments to the malloc() algorithm: M_MMAP_MAX=0 and M_TRIM_THRESHOLD=-1.
4 | Causes the following adjustments to the malloc() algorithm: M_MMAP_MAX=0, M_TRIM_THRESHOLD=-1, M_TOP_PAD=4096.

## Default

-qopt-malloc-options=0 | The compiler uses the default algorithm when malloc() is called. No call is made to mallopt().

## Description

This option lets you specify an alternate algorithm for malloc().

If you specify a non-zero value for n, it causes alternate configuration parameters to be set for how malloc() allocates and frees memory. It tells the compiler to insert calls to mallopt() to adjust these parameters to malloc() for dynamic memory allocation. This may improve speed.

## IDE Equivalent

None

## Alternate Options

None

Parent topic: Advanced Optimization Options