// Module included in the following assemblies:
//
// * observability/otel/otel-collector/otel-collector-processors.adoc

:_mod-docs-content-type: REFERENCE
[id="otel-processors-memory-limiter-processor_{context}"]
= Memory Limiter Processor

[role="_abstract"]
The Memory Limiter Processor periodically checks the Collector's memory usage and pauses data processing when the soft memory limit is reached. This processor supports traces, metrics, and logs. The preceding component, which is typically a receiver, is expected to retry sending the same data and may apply a backpressure to the incoming data. When memory usage exceeds the hard limit, the Memory Limiter Processor forces garbage collection to run.

.Example of the OpenTelemetry Collector custom resource when using the Memory Limiter Processor
[source,yaml]
----
# ...
  config:
    processors:
      memory_limiter:
        check_interval: 1s
        limit_mib: 4000
        spike_limit_mib: 800
    service:
      pipelines:
        traces:
          processors: [batch]
        metrics:
          processors: [batch]
# ...
----

.Parameters used by the Memory Limiter Processor
[options="header"]
[cols="a,a,a"]
|===
|Parameter |Description |Default

|`check_interval`
|Time between memory usage measurements. The optimal value is `1s`. For spiky traffic patterns, you can decrease the `check_interval` or increase the `spike_limit_mib`.
|`0s`

|`limit_mib`
|The hard limit, which is the maximum amount of memory in MiB allocated on the heap. Typically, the total memory usage of the OpenTelemetry Collector is about 50 MiB greater than this value.
|`0`

|`spike_limit_mib`
|Spike limit, which is the maximum expected spike of memory usage in MiB. The optimal value is approximately 20% of `limit_mib`. To calculate the soft limit, subtract the `spike_limit_mib` from the `limit_mib`.
|20% of `limit_mib`

|`limit_percentage`
|Same as the `limit_mib` but expressed as a percentage of the total available memory. The `limit_mib` setting takes precedence over this setting.
|`0`

|`spike_limit_percentage`
|Same as the `spike_limit_mib` but expressed as a percentage of the total available memory. Intended to be used with the `limit_percentage` setting.
|`0`

|===
