> ## Documentation Index
> Fetch the complete documentation index at: https://docs.siderolabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

> OOMConfig is a Out of Memory handler config document.

# OOMConfig

export const VersionWarningBanner = () => {
  const latestVersion = "v1.13";
  const [latestUrl, setLatestUrl] = useState(null);
  const [currentVersion, setCurrentVersion] = useState(null);
  const [isBeta, setIsBeta] = useState(false);
  const parseVersion = v => v.replace("v", "").split(".").map(Number);
  const isGreaterVersion = (a, b) => {
    const [aMajor, aMinor] = parseVersion(a);
    const [bMajor, bMinor] = parseVersion(b);
    if (aMajor > bMajor) return true;
    if (aMajor === bMajor && aMinor > bMinor) return true;
    return false;
  };
  useEffect(() => {
    if (typeof window === "undefined") return;
    const {pathname, hash, search} = window.location;
    const match = pathname.match(/\/talos\/(v\d+\.\d+)\//);
    if (!match) return;
    const detectedVersion = match[1];
    if (detectedVersion === latestVersion) return;
    setCurrentVersion(detectedVersion);
    if (isGreaterVersion(detectedVersion, latestVersion)) {
      setIsBeta(true);
    }
    const newPath = pathname.replace(`/talos/${detectedVersion}/`, `/talos/${latestVersion}/`);
    setLatestUrl(`${newPath}${search}${hash}`);
  }, []);
  if (!latestUrl || !currentVersion) return null;
  return <div className="not-prose sticky top-6 z-50 my-6">
      <div className="border border-yellow-500/30 bg-yellow-500/10 px-4 py-3 rounded-xl">
        <div className="text-sm">
          {isBeta ? <>
              ⚠️ You are viewing a <strong>beta version</strong> of Talos ({currentVersion}).
              This version may be unstable.
              <a href={latestUrl} className="ml-2 underline text-yellow-400 hover:text-yellow-300 font-medium">
                View latest stable version {latestVersion} →
              </a>
            </> : <>
              ⚠️ You are viewing an older version of Talos ({currentVersion}).
              <a href={latestUrl} className="ml-2 underline text-yellow-400 hover:text-yellow-300 font-medium">
                View the latest version {latestVersion} →
              </a>
            </>}
        </div>
      </div>
    </div>;
};

<VersionWarningBanner />

```yaml theme={null}
apiVersion: v1alpha1
kind: OOMConfig
triggerExpression: memory_full_avg10 > 12.0 && d_memory_full_avg10 > 0.0 && time_since_trigger > duration("500ms") # This expression defines when to trigger OOM action.
cgroupRankingExpression: 'memory_max.hasValue() ? 0.0 : ({Besteffort: 1.0, Burstable: 0.5, Guaranteed: 0.0, Podruntime: 0.0, System: 0.0}[class] * double(memory_current.orValue(0u)))' # This expression defines how to rank cgroups for OOM handler.
sampleInterval: 100ms # How often should the trigger expression be evaluated.
```

<table>
  <thead>
    <tr>
      <th>Field</th>
      <th>Type</th>
      <th>Description</th>
      <th>Value(s)</th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>`triggerExpression`</td>
      <td>Expression</td>
      <td>This expression defines when to trigger OOM action.<br /><br />The expression must evaluate to a boolean value.<br />If the expression returns true, then OOM ranking and killing will be handled.<br /><br />This expression receives the following parameters:<br />- `memory_{some,full}_{avg10,avg60,avg300,total}` - double, representing PSI values<br />- time\_since\_trigger - duration since the last OOM handler trigger event</td>

      <td />
    </tr>

    <tr>
      <td>`cgroupRankingExpression`</td>
      <td>Expression</td>
      <td>This expression defines how to rank cgroups for OOM handler.<br /><br />The cgroup with the highest rank (score) will be evicted first.<br />The expression must evaluate to a double value.<br /><br />This expression receives the following parameters:<br />- memory\_max - Optional{"<"}uint{">"} - in bytes<br />- memory\_current - Optional{"<"}uint{">"} - in bytes<br />- memory\_peak - Optional{"<"}uint{">"} - in bytes<br />- path - string, path to the cgroup<br />- class - int. This represents cgroup QoS class, and matches one of the constants, which are also provided: Besteffort, Burstable, Guaranteed, Podruntime, System</td>

      <td />
    </tr>

    <tr>
      <td>`sampleInterval`</td>
      <td>Duration</td>
      <td>How often should the trigger expression be evaluated.<br /><br />This interval determines how often should the OOM controller<br />check for the OOM condition using the provided expression.<br />Adjusting it can help tune the reactivity of the OOM handler.</td>

      <td />
    </tr>
  </tbody>
</table>
