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

# Increase system memory

## Introduction

Yocto builds often compile large components such as LLVM, which require
significant memory. Builds may fail with out-of-memory (OOM) errors if
sufficient RAM or swap is not available. This section describes methods to
increase available system memory and improve build stability.

## Increase Swap Space

If your build fails due to OOM errors, increase the swap space to at least
32 GB (recommended: 64 GB). Run the following commands to resize the swap file

```bash theme={null}
sudo su root
swapon --show
swapoff /swapfile
fallocate -l 64G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
free -h
```

## Increase zram

You can also increase compressed in-memory swap (zram) to improve memory
usage efficiency

```bash theme={null}
modprobe zram
zramctl /dev/zram0 --algorithm zstd --size "$(($(grep -Po 'MemTotal:\s*\K\d+' /proc/meminfo)/2))KiB"
mkswap -U clear /dev/zram0
swapon --discard --priority 100 /dev/zram0
```
