# Kotlin/Native binary options This page lists helpful Kotlin/Native binary options that you can use to configure Kotlin/Native [final binaries](https://kotlinlang.org/docs/multiplatform/multiplatform-build-native-binaries.html) and the ways to set up binary options in your project. ## How to enable You can enable binary options in the `gradle.properties` file, your build file, or pass them as compiler arguments. ### In Gradle properties You can set binary options in your project's `gradle.properties` file using the `kotlin.native.binary` property. For example: ``` kotlin.native.binary.latin1Strings=true ``` ### In your build file You can set binary options for your project in your `build.gradle.kts` file: * For specific binaries using the `binaryOption` attribute. For example: ```KOTLIN kotlin { iosArm64 { binaries { framework { binaryOption("smallBinary", "true") } } } } ``` * As `-Xbinary=$option=$value` compiler options in the `freeCompilerArgs` attribute. For example: ```KOTLIN kotlin { iosArm64 { compilations.configureEach { compilerOptions.configure { freeCompilerArgs.add("-Xbinary=smallBinary=true") } } } } ``` ### In the command-line compiler You can pass binary options as `-Xbinary=$option=$value` directly in the command line when executing the [Kotlin/Native compiler](native-get-started.html#using-the-command-line-compiler). For example: ```BASH kotlinc-native main.kt -Xbinary=enableSafepointSignposts=true ``` ## Binary options Note: This table is not an exhaustive list of all the existing options, only the most notable ones. | Option |Values |Description |Status | --------------------------------------- | [enableReleaseBinaryCache](native-improving-compilation-time.html#enable-caches-for-release-binaries) | * `true` * `false` (default) |Enables the compiler to use caches in release mode, making builds faster at the expense of some compiler optimizations. |Experimental since 2.4.20 | | [objcExportBlockExplicitParameterNames](native-objc-interop.html#explicit-parameter-names-in-objective-c-block-types) | * `true` * `false (default)` |Adds explicit parameter names to function types for exported Objective-C headers. |Experimental since 2.2.20 | | [smallBinary](whatsnew2220.html#smaller-binary-size-for-release-binaries) | * `true` * `false` (default) |Decreases the binary size for release binaries. |Experimental since 2.2.20 | | [stackProtector](whatsnew2220.html#support-for-stack-canaries-in-binaries) | * `yes` * `strong` * `all` * `no` (default) |Enables stack canaries: use `yes` for vulnerable functions, `all` for all functions, and `strong` to use a stronger heuristic. |Available since 2.2.20 | | [pagedAllocator](native-memory-manager.html#disable-allocator-paging) | * `true` (default) * `false` |Controls paging of allocations (buffering). When `false`, the memory allocator reserves memory on a per-object basis. |Experimental since 2.2.0 | | [latin1Strings](native-memory-manager.html#enable-support-for-latin-1-strings) | * `true` * `false` (default) |Controls support for Latin-1-encoded strings to reduce application binary size and adjust memory consumption. |Experimental since 2.2.0 | | [mmapTag](native-memory-manager.html#track-memory-consumption-on-apple-platforms) |`UInt` |Controls memory tagging, necessary for memory consumption tracking on Apple platforms. Values `240`-`255` are available (default is `246`); `0` disables tagging. |Available since 2.2.0 | | `disableMmap` | * `true` * `false` (default) |Controls the default allocator. When `true`, uses the `malloc` memory allocator instead of `mmap`. |Available since 2.2.0 | | [gc](native-memory-manager.html#garbage-collector) | * `cms` (default) * `pmcs` * `stwms` * [noop](native-memory-manager.html#disable-garbage-collection) |Controls garbage collection behavior: * `cms` uses concurrent mark and sweep * `pmcs` uses parallel mark concurrent sweep * `stwms` uses simple stop-the-world mark and sweep * `noop` disables garbage collection |`cms` is default since 2.4.0 | | [gcMarkSingleThreaded](native-memory-manager.html#garbage-collector) | * `true` * `false` (default) |Disables parallelization of the mark phase in garbage collection. May increase GC pause time on large heaps. |Available since 1.7.20 | | [enableSafepointSignposts](native-memory-manager.html#monitor-gc-performance) | * `true` * `false` (default) |Enables tracking GC-related pauses in the project for debugging in Xcode Instruments. |Available since 2.0.20 | | `preCodegenInlineThreshold` |`UInt` | Configures inlining optimization pass in the Kotlin IR compiler, which comes before the actual code generation phase (disabled by default). The recommended number of tokens (code units parsed by the compiler) is 40. |Experimental since 2.1.20 | | [objcDisposeOnMain](native-arc-integration.html#deinitializers) | * `true` (default) * `false` |Controls deinitialization of Swift/Objective-C objects. When `false`, deinitialization happens on a special GC thread instead of the main one. |Available since 1.9.0 | | [appStateTracking](native-arc-integration.html#support-for-background-state-and-app-extensions) | * `enabled` * `disabled` (default) | Controls timer-based invocation of the garbage collector when the application runs in the background. When `enabled`, GC is called only when memory consumption becomes too high. |Experimental since 1.7.20 | | `bundleId` | * `String` |Sets bundle ID (`CFBundleIdentifier`) in the `Info.plst` file. |Available since 1.7.20 | | `bundleShortVersionString` | * `String` |Sets short bundle version (`CFBundleShortVersionString`) in the `Info.plst` file. |Available since 1.7.20 | | `bundleVersion` | * `String` |Sets bundle version (`CFBundleVersion`) in the `Info.plst` file. |Available since 1.7.20 | | `sourceInfoType` | * `libbacktrace` * `coresymbolication` (Apple targets) * `noop` (default) | Adds file locations and line numbers to exception stack traces. `coresymbolication` is only available for Apple targets and enabled by default for macOS and Apple simulators in debug mode. |Experimental since 1.6.20 | Tip: For more information on stability levels, see the [documentation](components-stability.html#stability-levels-explained). ## What's next Learn how to [build final native binaries](https://kotlinlang.org/docs/multiplatform/multiplatform-build-native-binaries.html).